samedi 29 décembre 2018

Why does the first time I land on Laravel URL it renders HTTP based on Elastic Beanstalk?

I am using laravel 5.5 The application is being served on Elastic beanstalk single instance. I am able to server the Laravel application on HTTPS. However, when I first land on the link it serves as HTTP. IF I refresh the link it will again run on HTTPS. To test I cleared all the cookies and put the link on the address bar, again the first time I land there it serves in HTTP and again if I refresh the page it serves on HTTPS.

To serve the laravel app on Elastic Beanstalk I have already updated the SSL certificate.

Using the .htaccess as below

# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1 

Additionally to serve all the pages on HTTPS I have included the code as below in the boot method of AppServiceProvider

\URL::forceScheme('https');

This is very annoying as I dont really get if it is the Laravel app problem or the server problem.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2SqCrR3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire