Support the ongoing development of Laravel.io →
posted 9 years ago
Security
Last updated 1 year ago.
0

I have the same problem :) Try to dump Request::server() and find info about your connection

This example works for me:

if (Request::server('HTTP_X_FORWARDED_PROTO') == 'https')
{
   echo "secure";
} else {
   echo "unsecure";
}
Last updated 1 year ago.
0

I just had the same problem.

Are you behind a loadbalancer or something similar? We are using AWS Beanstalk with a LoadBalancer and the 443 is redirected to port 80. Request::secure() returns false even though the URI reads "https". Using a method similar to the above is what we ended up doing.

You might also look at : https://github.com/fideloper/TrustedProxy We still check the Request, but the proxy method helps.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

AllanNL allannl Joined 22 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.