PaulBGD
PaulBGD

Reputation: 2084

Removing start of path from nginx proxy_pass

To remove the use of ports on several of the applications running on this server, I've been using nginx's proxy_pass to do this. However, for some reason the actual url is being passed to the application. Is there a way so that it thinks /panel is really just /?

location /panel {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   Host      $http_host;
    proxy_pass         http://127.0.0.1:8082/;
}

Upvotes: 11

Views: 23372

Answers (1)

MatCas
MatCas

Reputation: 843

You need to add the trailing slash

location /panel/ {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   Host      $http_host;
    proxy_pass         http://127.0.0.1:8082/;
}

Upvotes: 27

Related Questions