How yo force https all Filament routes

Hello, how I can force al Filament routes yo use Https?
10 Replies
Hotcat
Hotcat2y ago
Probably you need to config laravel not filament. https://stackoverflow.com/a/44442699
Stack Overflow
Laravel HTTPS routes
today I decided to move my website to HTTPS. Early my website work on HTTP. My problem is in misunderstood how Laravel pass HTTP and https in helpers function route('name') I change my website UR...
Hotcat
Hotcat2y ago
Or to configure your server Apache/Nginx
awcodes
awcodes2y ago
If you just set your APP_URL in your .env to https. Laravel will pick that up and serve all routes with it.
H.Bilbao
H.BilbaoOP2y ago
As you say I have it configured, but if a user enters with http it does not redirect to https. I don't know if you can see that it is on a subdomain.
krekas
krekas2y ago
It's not a filament problem. Your server configuration
H.Bilbao
H.BilbaoOP2y ago
I've tried this in .htaccess file but it doesn't work as I would like:
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
For example, if I put http://demo.domain.com/admin in the URL it redirects to https://demo.domain.com and I would like it to redirect to https://demo.domain.com/admin
cheesegrits
cheesegrits2y ago
Do you also want https://demo.domain.com to redirect to https://demo.domain.com/admin ? As krekas said, nothing to do with Filament, it's just basic server config, I'm just interested.
awcodes
awcodes2y ago
Is your server using nginx as a proxy for Apache? I’m not an expert on this stuff but something to consider.
krekas
krekas2y ago
Really doubt it needs to be done in .htaccess
cheesegrits
cheesegrits2y ago
Normalizing the schema yes, best done in htaccess. Redirecting from / to /admin could be done in a Laravel route. Still no Filament.

Did you find this page helpful?