- Does Nginx see it as a HTTPS connection?
- Have you got the sites setup correctly with no duplicate or misconfigured server_names?
- Do you have any redirects for www/non-www?
Too many redirect when active SSL
Hello Guys,
I'm trying to use Laravel LetsEncrypt (Beta), but when I activate the SSL and refresh the page I have an error ERR_TOO_MANY_REDIRECTS.
Somebody knows and know how to solve?
Thanks!
@bashy I set up my server using Forge... I checked the third option about redirects and without https works fine but when I active https have erros!
View the vhost config for your site. I can't really say what the issue is without knowing more. You need to do more debugging.
maybe you need to change your base_URL in the .env? does it have http:// by any chance?
also I would go to any URL and for the corresponding method do a dd("dd"); to see if the error is with nginx or actual laravel? (previously I have gotten same too many redirects and it has always been an error with something in my laravel rather than nginx/apache)
Try adding in app/providers/AppServiceProvider in the boot method
If(env(' APP_ENV') !== 'local') { $url->forceSchema('https'); }
This will set all Laravel routes to https including CSS, js and images links.
@jekinney Laravel is pretty much fully protocol oblivious? Which ever one you use HTTP/HTTPS, it will serve files related to the current protocol.
Nope. Three weeks ago I deployed a site that was 100% https and though it work, the console had errors that the files (CSS etc) where not https. Took me a few hours researching and googling. The code above fixed the errors and a few redirect issues. Now every call internally is using https, but on homestead http.
By default it http unless you use explicit routes or secure_asset helper.
@jekinney Very strange, never had that issue. I've always referenced them with asset(), elixir() etc. It should use the current protocol for those. Which did you use? All the code I've checked for the functions to reference assets/files uses the current protocol.
Same as you. Like I said it works and css is correct but in the console I get warning using https and trying to serve http.
If you deploy in Laravel Forge, there is no need to add Middleware or set in AppServiceProvider boot() for the\URL::forceScheme('https');
If you add it, you put yourselves in too many redirect issue.
Taylor basically already done all the redirect in Nginx Configuration
This fixed it for me: Try changing your Cloudflare -> 'Crypto' tab -> SSL to 'Strict'
From: https://laracasts.com/discuss/channels/forge/lets-encrypt-ssl-too-many-redirects#reply=125255
@alev exact same issue. Fixed
@alev If some one not able to found Cloudflare -> 'Crypto' tab Just check SSL/TLS -> Overview from left menu and change SSL/TLS encryption mode to Full or Full (strict)
@alev Thank you so much <3 Fixed it right away.
@alev superstar. This worked for me too! Thanks.
@ALEV - Thank you very much :D
Please or to participate in this conversation.