Skip to content

Commit

Permalink
Update laravel.md
Browse files Browse the repository at this point in the history
In order to get Laravel generating proper URLs, the TrustProxies middleware needs to be changed.
  • Loading branch information
jjmontgo authored Feb 5, 2022
1 parent 518f5bf commit 1b152a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/frameworks/laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ uploading your assets to S3 automatically.
For more details, see the [Websites section](/docs/websites.md) of this documentation
and the official <a href="https://github.com/getlift/lift/blob/master/docs/server-side-website.md">Lift documentation</a>.

### Trusted proxies

Because Laravel is executed through API Gateway, the Host header is set to the API Gateway host name. Helper functions
such as redirect() will incorrectly use this host name. The correct host name is set on X_FORWARDED_HOST.

To get Laravel to use X_FORWARDED_HOST instead, edit the TrustProxies middleware and set $proxies to the * wildcard:

``` class TrustProxies extends Middleware
{
...
protected $proxies = '*';
```

### Assets in templates

Assets referenced in templates should be via the `asset()` helper:
Expand Down

0 comments on commit 1b152a3

Please sign in to comment.