Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Support x-forwarded-prefix in TrustProxies.php #40014

Merged
merged 4 commits into from
Dec 13, 2021

Conversation

ppodds
Copy link
Contributor

@ppodds ppodds commented Dec 13, 2021

#39996

If we want to deploy laravel project in a subfolder of the domain like the following Nginx setting. We need to use the x-forwarded-prefix header.

server {
  listen 80;
  listen [::]:80;

  server_name _;
  location /to/project/ {
    proxy_set_header X-Forwarded-Prefix /to/project;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_set_header X-Forwarded-Host my.domain;
    proxy_set_header X-Forwarded-Port 443;
    # laravel backend at localhost:8080
    proxy_pass http://localhost:8080/;
}

Symfony has already supported the x-forwarded-prefix header. We can deploy laravel in the subfolder of domain with this feature.

@ppodds ppodds changed the title Support x-forwarded-prefix in TrustProxies.php [9.x] Support x-forwarded-prefix in TrustProxies.php Dec 13, 2021
@ppodds ppodds marked this pull request as ready for review December 13, 2021 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants