Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Rretzko's avatar
Level 15

Incorrect protocol from route() on DigitalOcean

Hi - This is more of a DigitalOcean question, but I'm hoping one of you has run into this and will have an answer. When I use a route reference (ex: action="{{ route('login') }}") on DigitalOcean, it returns http://example.com/login instead of https://example.com/login. I've set both APP_URL and ASSET_URL settings to https://example.com . Do I also need to make changes to the htaccess file or add additional setting? Thanks for any guidance you can offer! Rick

0 likes
4 replies
Sinnbeck's avatar

Try redoing your cache with php artisan config:cache

martinbean's avatar
Level 80

@rretzko I imagine Digital Ocean will have some sort of load balancer or reverse proxy in front of your website. Therefore you will need to update your TrustProxies middleware so requests are correctly identified as HTTPS, etc.

Rretzko's avatar
Level 15

Thanks @sinnbeck & @martinbean ! I reset the cache and tested on a different browser, but had the same result. I changed the TrustProxies middleware to $proxies='*' and that corrected the problem! Follow-up: Am I exposing vulnerabilities with this wildcard setting? Rick

martinbean's avatar

@Rretzko It’s for setting the IP address of the proxy connecting to your app. If DO’s load balancer has a fixed IP address, then you can use that instead. If it doesn’t (and the load balancer can have any IP address when connecting to your app) then you’ll need to use * like you have done.

Please or to participate in this conversation.