Skip to content

How to generate urls with https #438

Answered by omarherri
omarherri asked this question in Q&A
Discussion options

You must be logged in to vote

It is set with Https. But somehow i figured out what may cause the problem, so if anyone is having the same issue this typically happens because Laravel doesn't automatically detect that the request is coming through HTTPS when he is behind a reverse proxy like Traefik. The reverse proxy is terminating the SSL connection, and Nginx inside the container is seeing the request as http, even though it originally came over https.

To fix the issue you should add this to your boostrap/app:

->withMiddleware(function (Middleware $middleware) {
    $middleware->trustProxies(
            at: '*',
            headers: Request::HEADER_X_FORWARDED_TRAEFIK,
        );
})

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@omarherri
Comment options

@jaydrogers
Comment options

@omarherri
Comment options

Answer selected by omarherri
@omarherri
Comment options

@jaydrogers
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants