Skip to content

[8.x] Support x-forwarded-prefix in TrustProxies.php #40003

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

Closed
wants to merge 4 commits into from

Conversation

ppodds
Copy link
Contributor

@ppodds ppodds commented Dec 12, 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 marked this pull request as ready for review December 12, 2021 18:33
@GrahamCampbell GrahamCampbell changed the title Support x-forwarded-prefix in TrustProxies.php [8.x] Support x-forwarded-prefix in TrustProxies.php Dec 12, 2021
@GrahamCampbell
Copy link
Member

This kind of change is a breaking change IMO.

@driesvints
Copy link
Member

Please send this to master, thanks.

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.

3 participants