Thursday, March 9, 2017

Laravel is removing https when using route() helper

When I'm using the route() helper function to make urls on a https site, I get urls with http:// instead of https:// - I can avoid that by setting $absolute flag to false, but it seems stupid that it doens't use the same url that I'm on.

In .env, I've set APP_URL to https://xx so it's not using that either.

I don't want to force https, I just want links and redirects to keep the protocol.

I'm on a Varnish setup, where $_SERVER['HTTPS'] is not set even if it's using https, so I'm thinking that might have something to do with it.

If I use Form::open(), the problem is there too.

So, how do I make laravel keep protocol in links and redirects?

Example:

return redirect(route('my-route-name'));

cheers /Jonas



via smokiespartakus

Advertisement