[GH-ISSUE #98] URI support in proxy_pass #86

Closed
opened 2026-02-26 05:34:17 +03:00 by kerem · 5 comments
Owner

Originally created by @jlesage on GitHub (Mar 7, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/98

The nginx proxy_pass directive supports an URI:

proxy_pass http://localhost:8000/uri/;

See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

It would be useful to support this. This could be especially useful for custom locations, where one would want to forward without the location part. For example, with:

location /sub/ {
  proxy_pass http://192.168.1.1:8080/;
}

The following forwarding would occur:
http://example.com/sub/index.html -> http://192.168.1.1:8080/index.html

Or with:

location /sub/ {
  proxy_pass http://192.168.1.1:8080/other;
}

We would have:
http://example.com/sub/index.html -> http://192.168.1.1:8080/other/index.html

Originally created by @jlesage on GitHub (Mar 7, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/98 The nginx `proxy_pass` directive supports an URI: ``` proxy_pass http://localhost:8000/uri/; ``` See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass It would be useful to support this. This could be especially useful for custom locations, where one would want to forward without the location part. For example, with: ``` location /sub/ { proxy_pass http://192.168.1.1:8080/; } ``` The following forwarding would occur: `http://example.com/sub/index.html` -> `http://192.168.1.1:8080/index.html` Or with: ``` location /sub/ { proxy_pass http://192.168.1.1:8080/other; } ``` We would have: `http://example.com/sub/index.html` -> `http://192.168.1.1:8080/other/index.html`
kerem 2026-02-26 05:34:17 +03:00
Author
Owner

@jc21 commented on GitHub (Mar 7, 2019):

The former is already the case with Custom Locations released on 2.0.10. The latter could be an enhancement to that feature.

<!-- gh-comment-id:470384582 --> @jc21 commented on GitHub (Mar 7, 2019): The former is already the case with Custom Locations released on 2.0.10. The latter could be an enhancement to that feature.
Author
Owner

@jlesage commented on GitHub (Mar 7, 2019):

From what I see in genrated file, the proxy_pass is missing the ending slash, which makes nginx to not modify the forward URI.

<!-- gh-comment-id:470477564 --> @jlesage commented on GitHub (Mar 7, 2019): From what I see in genrated file, the `proxy_pass` is missing the ending slash, which makes nginx to *not* modify the forward URI.
Author
Owner

@kolbii commented on GitHub (Mar 10, 2019):

I just opened this PR #99 that resolves the sub-folder forwarding.
So it would look something like this:
location: /api
forward host: 1.1.1.1/custom-api
forward port: 8080
are proxied to 1.1.1.1:8080/custom-api

<!-- gh-comment-id:471274829 --> @kolbii commented on GitHub (Mar 10, 2019): I just opened this PR #99 that resolves the sub-folder forwarding. So it would look something like this: location: /api forward host: 1.1.1.1/custom-api forward port: 8080 are proxied to 1.1.1.1:8080/custom-api
Author
Owner

@briscula commented on GitHub (Nov 16, 2019):

Hi, Not sure where the problem is , but there is a bug in this feature.
{{ forward_path }} has same value as {{ path }} even if you provide a Forward Hostname without sub-folder. I just assume so, because I get a path not found from nginx when using it.

<!-- gh-comment-id:554584671 --> @briscula commented on GitHub (Nov 16, 2019): Hi, Not sure where the problem is , but there is a bug in this feature. `{{ forward_path }}` has same value as `{{ path }}` even if you provide a Forward Hostname without sub-folder. I just assume so, because I get a path not found from nginx when using it.
Author
Owner

@blade10101 commented on GitHub (Dec 25, 2023):

location /sub/ {
proxy_pass http://192.168.1.1:8080/;
}

That responds with a blank page.

<!-- gh-comment-id:1868744921 --> @blade10101 commented on GitHub (Dec 25, 2023): > location /sub/ { > proxy_pass http://192.168.1.1:8080/; > } That responds with a blank page.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#86
No description provided.