[GH-ISSUE #40] Support for subfolders in proxy hosts #39

Closed
opened 2026-02-26 05:33:29 +03:00 by kerem · 53 comments
Owner

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

Currently, a proxy host is hard-coded to the / (root) location.

In addition to this, it would be very useful to support multiple subfolders that can be mapped to different upstream servers. For example:

/app1 --> 192.168.1.1
/app2 --> 192.168.1.2

Originally created by @jlesage on GitHub (Jan 3, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/40 Currently, a proxy host is hard-coded to the `/` (root) location. In addition to this, it would be very useful to support multiple subfolders that can be mapped to different upstream servers. For example: `/app1` --> `192.168.1.1` `/app2` --> `192.168.1.2`
kerem 2026-02-26 05:33:29 +03:00
Author
Owner

@jlesage commented on GitHub (Jan 3, 2019):

This would allow using applications like Organizr (https://github.com/causefx/Organizr).

<!-- gh-comment-id:451137784 --> @jlesage commented on GitHub (Jan 3, 2019): This would allow using applications like Organizr (https://github.com/causefx/Organizr).
Author
Owner

@jc21 commented on GitHub (Jan 3, 2019):

So to be clear, you're wanting a proxy host for http://example.something.com/ to reverse proxy to an upstream http://192.168.0.1:8080/subfolder/ ?

This might have to be a new type of advanced proxy host as far as the UI is concerned.

<!-- gh-comment-id:451307519 --> @jc21 commented on GitHub (Jan 3, 2019): So to be clear, you're wanting a proxy host for `http://example.something.com/` to reverse proxy to an upstream `http://192.168.0.1:8080/subfolder/` ? This might have to be a new type of advanced proxy host as far as the UI is concerned.
Author
Owner

@jlesage commented on GitHub (Jan 3, 2019):

In fact it's more something like this:

  • http://example.something.com/app1 is forwarded to http://192.168.0.1:8080
  • http://example.something.com/app2 is forwarded to http://192.168.0.2:8080
  • ...
<!-- gh-comment-id:451309441 --> @jlesage commented on GitHub (Jan 3, 2019): In fact it's more something like this: - `http://example.something.com/app1` is forwarded to `http://192.168.0.1:8080` - `http://example.something.com/app2` is forwarded to `http://192.168.0.2:8080` - ...
Author
Owner

@Grasfer commented on GitHub (Jan 3, 2019):

In my nginx default server config i have this:

    location ^~ /nzbhydra {
            include /config/nginx/proxy.conf;
            proxy_pass http://192.168.1.150:5076/nzbhydra/;
    }

it makes to https://www.mydomain.com/nzbhydra works, for some things maybe you dont want a subdomain so would be nice to be able to add subfolder proxies.

<!-- gh-comment-id:451311541 --> @Grasfer commented on GitHub (Jan 3, 2019): In my nginx default server config i have this: location ^~ /nzbhydra { include /config/nginx/proxy.conf; proxy_pass http://192.168.1.150:5076/nzbhydra/; } it makes to https://www.mydomain.com/nzbhydra works, for some things maybe you dont want a subdomain so would be nice to be able to add subfolder proxies.
Author
Owner

@cjackson234 commented on GitHub (Jan 11, 2019):

It would also be nice to be able to group them under one domain.

so:

example.com
- /app1 --> 1.1.1.1:2222/coolapp
- /app2 --> 1.1.1.1:3333/coolapp2
<!-- gh-comment-id:453600863 --> @cjackson234 commented on GitHub (Jan 11, 2019): It would also be nice to be able to group them under one domain. so: ``` example.com - /app1 --> 1.1.1.1:2222/coolapp - /app2 --> 1.1.1.1:3333/coolapp2 ```
Author
Owner

@didusee commented on GitHub (Jan 14, 2019):

I’d like to second that request, in exactly the same way, that is described iby cjackson234: Subfolders with same IP.

nameoftheserver.com --> 1.1.1.1:80 --> Whatever Content
nameoftheserver.com/Docker1:1111 --> 1.1.1.1:1111 --> AppOrDocker1
nameoftheserver.com/Docker2:2222 --> 1.1.1.1:2222 --> AppOrDocker2

In addition to that all of the subfolders would work with the SSL certificate of the main address.

<!-- gh-comment-id:453995707 --> @didusee commented on GitHub (Jan 14, 2019): I’d like to second that request, in exactly the same way, that is described iby cjackson234: Subfolders with same IP. nameoftheserver.com --> 1.1.1.1:80 --> Whatever Content nameoftheserver.com/Docker1:1111 --> 1.1.1.1:1111 --> AppOrDocker1 nameoftheserver.com/Docker2:2222 --> 1.1.1.1:2222 --> AppOrDocker2 … In addition to that all of the subfolders would work with the SSL certificate of the main address.
Author
Owner

@DracoMilesX commented on GitHub (Jan 14, 2019):

Would love to see this too. For me it would be example.domain.ltd to ip:port/site

<!-- gh-comment-id:454125130 --> @DracoMilesX commented on GitHub (Jan 14, 2019): Would love to see this too. For me it would be example.domain.ltd to ip:port/site
Author
Owner

@ytwytw commented on GitHub (Feb 10, 2019):

Is it possible to be done with "Custom Nginx Configuration" in Advance?

<!-- gh-comment-id:462166059 --> @ytwytw commented on GitHub (Feb 10, 2019): Is it possible to be done with "Custom Nginx Configuration" in Advance?
Author
Owner

@Karatekid2407 commented on GitHub (Apr 8, 2019):

Is there any news?
I would also like to do it this way.

<!-- gh-comment-id:480731461 --> @Karatekid2407 commented on GitHub (Apr 8, 2019): Is there any news? I would also like to do it this way.
Author
Owner

@qy2009 commented on GitHub (Jul 30, 2019):

any update on this issue? hope the enhancement will be implemented soon :)

<!-- gh-comment-id:516211192 --> @qy2009 commented on GitHub (Jul 30, 2019): any update on this issue? hope the enhancement will be implemented soon :)
Author
Owner

@KrunchMuffin commented on GitHub (Jan 7, 2020):

Just found out about this project in unraid apps. But I need this option to use it. Any word?

<!-- gh-comment-id:571426044 --> @KrunchMuffin commented on GitHub (Jan 7, 2020): Just found out about this project in unraid apps. But I need this option to use it. Any word?
Author
Owner

@jc21 commented on GitHub (Jan 7, 2020):

Not in version 2. This feature request will be considered in v3, but I can't make any promises yet.

<!-- gh-comment-id:571426330 --> @jc21 commented on GitHub (Jan 7, 2020): Not in version 2. This feature request will be considered in v3, but I can't make any promises yet.
Author
Owner

@circa1665 commented on GitHub (Mar 11, 2020):

Any news on this?

<!-- gh-comment-id:597932789 --> @circa1665 commented on GitHub (Mar 11, 2020): Any news on this?
Author
Owner

@jameski83 commented on GitHub (Mar 18, 2020):

also interested in this to use with https://github.com/causefx/Organizr. This GUI is fantastic. Keep up the good work!

<!-- gh-comment-id:600651694 --> @jameski83 commented on GitHub (Mar 18, 2020): also interested in this to use with https://github.com/causefx/Organizr. This GUI is fantastic. Keep up the good work!
Author
Owner

@phobiac commented on GitHub (Jul 13, 2020):

I was butting up against this issue when trying to use this add on with Ombi and found this issue as well as this issue at the Ombi repo that allowed me to get this working. I have not set up a similar reverse proxy for Radarr/Sonarr/Organizr/etc. however I assume the solution for those would work similarly.

What worked for me was to:

Define a custom location, filling in the required values (that I suspect are being overwritten in the next step?)

Set a custom nginx configuration for by clicking the settings gear icon and putting in:

        proxy_pass http://127.0.0.1/ombi;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection keep-alive;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    } 

Then, in ombi I had to set the base url to "/ombi". I have checked and sonarr/radarr have a similar setting, so getting things working in those should follow a similar process.

Both of those threads go into detail about varying nginx configurations. I stopped playing with things once they were working, so it's possible some of the other suggested settings would work for you in your specific application.

<!-- gh-comment-id:657355234 --> @phobiac commented on GitHub (Jul 13, 2020): I was butting up against this issue when trying to use this add on with Ombi and found [this issue](https://github.com/tidusjar/Ombi/issues/1751) as well as [this issue](https://github.com/tidusjar/Ombi/issues/1922) at the Ombi repo that allowed me to get this working. I have not set up a similar reverse proxy for Radarr/Sonarr/Organizr/etc. however I assume the solution for those would work similarly. What worked for me was to: Define a custom location, filling in the required values (that I suspect are being overwritten in the next step?) Set a custom nginx configuration for by clicking the settings gear icon and putting in: ```location /ombi { proxy_pass http://127.0.0.1/ombi; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } ``` Then, in ombi I had to set the base url to "/ombi". I have checked and sonarr/radarr have a similar setting, so getting things working in those should follow a similar process. Both of those threads go into detail about varying nginx configurations. I stopped playing with things once they were working, so it's possible some of the other suggested settings would work for you in your specific application.
Author
Owner

@stebla27 commented on GitHub (Nov 8, 2020):

I also need this feature! Any updates about this?

<!-- gh-comment-id:723603393 --> @stebla27 commented on GitHub (Nov 8, 2020): I also need this feature! Any updates about this?
Author
Owner

@CorneliousJD commented on GitHub (Dec 7, 2020):

Also looking for this - as the "Custom locations" does not work how one might expect it to.

Specifically I need this for SSO Plex integration in Organizr as well (as others have noted)
See here: https://docs.organizr.app/books/setup-features/page/sso/#plex

It requires a domain.com/plex and NOT a plex.domain.com so mydomain.com points to 1.1.1.1:8123 and plex.mydomain.com points to 1.1.1.1:32400 but I need mydomain.com to point to 1.1.1.1:8123 while mydomain.com/plex goes to 1.1.1.1:32400 (custom location)

Hoipng for some good news on this soon as swapping from a config-file based reverse proxy to NPM has broken this SSO feature for me.

Thanks.

<!-- gh-comment-id:739647515 --> @CorneliousJD commented on GitHub (Dec 7, 2020): Also looking for this - as the "Custom locations" does not work how one might expect it to. Specifically I need this for SSO Plex integration in Organizr as well (as others have noted) See here: https://docs.organizr.app/books/setup-features/page/sso/#plex It requires a domain.com/plex and NOT a plex.domain.com so mydomain.com points to 1.1.1.1:8123 and plex.mydomain.com points to 1.1.1.1:32400 but I need mydomain.com to point to 1.1.1.1:8123 while mydomain.com/plex goes to 1.1.1.1:32400 (custom location) Hoipng for some good news on this soon as swapping from a config-file based reverse proxy to NPM has broken this SSO feature for me. Thanks.
Author
Owner

@bb12489 commented on GitHub (Dec 18, 2020):

I'm also requesting this feature be added. I've been using the Swag container on Unraid, and this has been working just fine there. I'm kinda surprised to see that this isn't implemented in NPM

<!-- gh-comment-id:747964574 --> @bb12489 commented on GitHub (Dec 18, 2020): I'm also requesting this feature be added. I've been using the Swag container on Unraid, and this has been working just fine there. I'm kinda surprised to see that this isn't implemented in NPM
Author
Owner

@CorneliousJD commented on GitHub (Dec 22, 2020):

So I've resolved my personal issue with this.

I needed domain.com to host Organizr, and domain.com/plex to point to Plex, per my last comment - it has to be a /location and not plex.domain.com

I did this not by adding /plex location but by adding a /web location, because that's what is appened to the end of the Plex URL so this is the ONLY thing that seemed to work for me.

Custom Location of /web with this setup.
image

I now have Organizr setup with Plex OAuth, SSO across Plex, Ombi, Tautulli, and "watch on plex" buttons working, all via NPM :)
hope this comment helps someone else in the future!

<!-- gh-comment-id:749770892 --> @CorneliousJD commented on GitHub (Dec 22, 2020): So I've resolved my personal issue with this. I needed domain.com to host Organizr, and domain.com/plex to point to Plex, per my last comment - it has to be a /location and not plex.domain.com I did this not by adding /plex location but by adding a /web location, because that's what is appened to the end of the Plex URL so this is the ONLY thing that seemed to work for me. Custom Location of /web with this setup. ![image](https://user-images.githubusercontent.com/724777/102932152-be507500-446d-11eb-9adc-067c0f55343d.png) I now have Organizr setup with Plex OAuth, SSO across Plex, Ombi, Tautulli, and "watch on plex" buttons working, all via NPM :) hope this comment helps someone else in the future!
Author
Owner

@SF73 commented on GitHub (Jan 12, 2021):

Any news on this feature?
I have several docker container running and I would like to use subfolders instead of subdomain to access them.

<!-- gh-comment-id:759101601 --> @SF73 commented on GitHub (Jan 12, 2021): Any news on this feature? I have several docker container running and I would like to use subfolders instead of subdomain to access them.
Author
Owner

@ftruzzi commented on GitHub (Jan 12, 2021):

I was surprised this isn't supported -- what is the Define location feature meant for, then?

@SF73 I used https://github.com/linuxserver/docker-swag/, which comes with a few presets you can easily edit (but no UI)

<!-- gh-comment-id:759109244 --> @ftruzzi commented on GitHub (Jan 12, 2021): I was surprised this isn't supported -- what is the `Define location` feature meant for, then? @SF73 I used https://github.com/linuxserver/docker-swag/, which comes with a few presets you can easily edit (but no UI)
Author
Owner

@C-Fu commented on GitHub (Jan 13, 2021):

@ftruzzi @SF73 it's not supported? I was trying to figure out what I did wrong with Define location, since I thought it's for mapping subfolders to a service

<!-- gh-comment-id:759262490 --> @C-Fu commented on GitHub (Jan 13, 2021): @ftruzzi @SF73 it's not supported? I was trying to figure out what I did wrong with Define location, since I thought it's for mapping subfolders to a service
Author
Owner

@ricardopaiva commented on GitHub (Mar 18, 2021):

Someone found a workaround for this? Thanks

<!-- gh-comment-id:802081414 --> @ricardopaiva commented on GitHub (Mar 18, 2021): Someone found a workaround for this? Thanks
Author
Owner

@redtripleAAA commented on GitHub (Mar 21, 2021):

The only workaround for now is using subdomains instead of subfolders

Subdomain >>> Same vHost >>> Then edit the advanced location to point to the subfolder

For example:

welcome.company.com >>> http://10.0.12.16:8000 >>> 
location = /{return 301 $scheme://$http_host/welcomepage;}

about.company.com >>> http://10.0.12.16:8000 >>> 
location = /{return 301 $scheme://$http_host/aboutpage;}

It's working for me fine, but I would love to see a support for the feature to use subfolders instead.

<!-- gh-comment-id:803543820 --> @redtripleAAA commented on GitHub (Mar 21, 2021): The only workaround for now is using subdomains instead of subfolders > Subdomain >>> Same vHost >>> Then edit the advanced location to point to the subfolder For example: ``` welcome.company.com >>> http://10.0.12.16:8000 >>> location = /{return 301 $scheme://$http_host/welcomepage;} ``` ``` about.company.com >>> http://10.0.12.16:8000 >>> location = /{return 301 $scheme://$http_host/aboutpage;} ``` It's working for me fine, but I would love to see a support for the feature to use subfolders instead.
Author
Owner

@ricardopaiva commented on GitHub (Mar 21, 2021):

Thanks @ansred . I’m using subdomains but that means having to create a lot of subdomains on my dns provider.
But for now that’s what I’m going to do.
{return 301 $scheme://$http_host/aboutpage;}
What is this for? I haven’t configured any location and it seems to be working properly.

<!-- gh-comment-id:803582205 --> @ricardopaiva commented on GitHub (Mar 21, 2021): Thanks @ansred . I’m using subdomains but that means having to create a lot of subdomains on my dns provider. But for now that’s what I’m going to do. `{return 301 $scheme://$http_host/aboutpage;} ` What is this for? I haven’t configured any location and it seems to be working properly.
Author
Owner

@redtripleAAA commented on GitHub (Mar 21, 2021):

@ricardopaiva on the DNS provider level, for example with Cloudflare, you can create one A or CNAME record using *.domain.com to point to your nginx server IP

And then all the subdmains can be handled on the nginx server as hosts only, no need for creating dozes of subdomains twice.

Only once as wildcard on the DNS provider.

Regarding the location features, it's designed to redirect to specific page. like the example above.

You can test it out on any host you have and use the same location script I used above, just change the aboutpage part to whatever the sub-page you wish to redirect.

<!-- gh-comment-id:803658100 --> @redtripleAAA commented on GitHub (Mar 21, 2021): @ricardopaiva on the DNS provider level, for example with Cloudflare, you can create one A or CNAME record using *.domain.com to point to your nginx server IP And then all the subdmains can be handled on the nginx server as hosts only, no need for creating dozes of subdomains twice. Only once as wildcard on the DNS provider. Regarding the location features, it's designed to redirect to specific page. like the example above. You can test it out on any host you have and use the same location script I used above, just change the **aboutpage** part to whatever the sub-page you wish to redirect.
Author
Owner

@ricardopaiva commented on GitHub (Mar 21, 2021):

That's awesome! Didn't know about that. I'll give it a try. I really appreciated your feedback.

<!-- gh-comment-id:803658452 --> @ricardopaiva commented on GitHub (Mar 21, 2021): That's awesome! Didn't know about that. I'll give it a try. I really appreciated your feedback.
Author
Owner

@chaptergy commented on GitHub (May 10, 2021):

So the custom locations do not work for you? Adding a custom location to a host should resolve to

location /test {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_pass       http://forward.domain.com:80;
    
}

within the nginx config.

<!-- gh-comment-id:837204859 --> @chaptergy commented on GitHub (May 10, 2021): So the custom locations do not work for you? Adding a custom location to a host should resolve to ``` location /test { proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://forward.domain.com:80; } ``` within the nginx config.
Author
Owner

@TWART016 commented on GitHub (May 12, 2021):

You mean under Advanced?I tried this

location /test {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_pass       http://192.168.178.15:5801;
}

location /test2 {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_pass       http://192.168.178.15:8082;
}

with htttp://mydomain.com I can open another nginx server (IP and Port defined in Details page) but with htttp://mydomain.com/test I get 404 Not Found
This should open the webpage (jDownloader2) from http://192.168.178.15:5801

With htttp://mydomain.com/test2 I get 502 Bad Gateway - openresty
http://192.168.178.15:8082 ist the default Website of NPM (Congratulations! ...)

<!-- gh-comment-id:839305085 --> @TWART016 commented on GitHub (May 12, 2021): You mean under Advanced?I tried this ```nginx location /test { proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://192.168.178.15:5801; } location /test2 { proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://192.168.178.15:8082; } ``` with htttp://mydomain.com I can open another nginx server (IP and Port defined in Details page) but with htttp://mydomain.com/test I get 404 Not Found This should open the webpage (jDownloader2) from http://192.168.178.15:5801 With htttp://mydomain.com/test2 I get 502 Bad Gateway - openresty http://192.168.178.15:8082 ist the default Website of NPM (Congratulations! ...)
Author
Owner

@chaptergy commented on GitHub (May 12, 2021):

It seems that I do not really understand your issue. I meant using the "custom locations" as in this comment. Those should generate an nginx config exactly as you need.

Do you have an nginx config which works for you, which you want to replicate in NPM?

<!-- gh-comment-id:839660710 --> @chaptergy commented on GitHub (May 12, 2021): It seems that I do not really understand your issue. I meant using the "custom locations" as in [this comment](https://github.com/jc21/nginx-proxy-manager/issues/40#issuecomment-749770892). Those should generate an nginx config exactly as you need. Do you have an nginx config which works for you, which you want to replicate in NPM?
Author
Owner

@TWART016 commented on GitHub (May 12, 2021):

I also tried it with custom locations
image

I do not have an existing nginx configuration. I just startet with reverse proxy.

<!-- gh-comment-id:839927767 --> @TWART016 commented on GitHub (May 12, 2021): I also tried it with custom locations ![image](https://user-images.githubusercontent.com/29805669/118012017-ea9f5c00-b350-11eb-97a5-84295764ff39.png) I do not have an existing nginx configuration. I just startet with reverse proxy.
Author
Owner

@NeonGOD78 commented on GitHub (May 28, 2021):

this config posted in advanced on the main domain will make plex work in a subfolder :

location /plex/ {
	proxy_pass http://192.168.1.9:32400/;
	client_max_body_size 10m;
	client_body_buffer_size 128k;
	proxy_bind $server_addr;
	proxy_buffers 32 4k;
	proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
	send_timeout 5m;
	proxy_read_timeout 240;
	proxy_send_timeout 240;
	proxy_connect_timeout 240;
	proxy_hide_header X-Frame-Options;
	proxy_set_header Host $host:$server_port;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto https;
	proxy_redirect  http://  $scheme://;
	proxy_http_version 1.1;
	proxy_set_header Connection "";
	proxy_no_cache $cookie_session;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
}

if ($http_referer ~ /plex/) {
	rewrite ^/web/(.*) /plex/web/$1? redirect;
}

You will need to edit the line: proxy_pass http://192.168.1.9:32400/; to match your local ip

<!-- gh-comment-id:850405876 --> @NeonGOD78 commented on GitHub (May 28, 2021): this config posted in advanced on the main domain will make plex work in a subfolder : ```nginx location /plex/ { proxy_pass http://192.168.1.9:32400/; client_max_body_size 10m; client_body_buffer_size 128k; proxy_bind $server_addr; proxy_buffers 32 4k; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; send_timeout 5m; proxy_read_timeout 240; proxy_send_timeout 240; proxy_connect_timeout 240; proxy_hide_header X-Frame-Options; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_redirect http:// $scheme://; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_no_cache $cookie_session; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } if ($http_referer ~ /plex/) { rewrite ^/web/(.*) /plex/web/$1? redirect; } ``` You will need to edit the line: proxy_pass http://192.168.1.9:32400/; to match your local ip
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2021):

I cannot figure this out at all, I am trying to do proxy subpath to port.

Screen Shot 2021-09-26 at 10 32 59 AM
Screen Shot 2021-09-26 at 10 33 05 AM

I will try advanced in as bit but you have to have an actual proxy record to do that, as they are required fields and I do not really understand how to add custom loc or advanced without a dummy proxy

<!-- gh-comment-id:927325623 --> @tablatronix commented on GitHub (Sep 26, 2021): I cannot figure this out at all, I am trying to do proxy subpath to port. ![Screen Shot 2021-09-26 at 10 32 59 AM](https://user-images.githubusercontent.com/807787/134814379-29806d24-88d5-4169-b63b-ce2331aa2e76.png) ![Screen Shot 2021-09-26 at 10 33 05 AM](https://user-images.githubusercontent.com/807787/134814384-c5d1209e-079c-4b5f-aefc-8ebb4da75b6b.png) I will try advanced in as bit but you have to have an actual proxy record to do that, as they are required fields and I do not really understand how to add custom loc or advanced without a dummy proxy
Author
Owner

@casperse commented on GitHub (Oct 20, 2021):

Any news on this?
I think I have the same problem with the Kuma uptime status page:
https://IP:PORT/status

<!-- gh-comment-id:947593561 --> @casperse commented on GitHub (Oct 20, 2021): Any news on this? I think I have the same problem with the Kuma uptime status page: https://IP:PORT/status
Author
Owner

@robinduerhager commented on GitHub (Mar 22, 2022):

So i just discovered that when using this configuration:

grafik
grafik

I can route to my pihole on the subpath /admin, by using pihole.cluster.lan/quack, but when using thecustom locations configuration down below, which should theoretically route me to the /admin subpath by using pihole.cluster.lan, it won't work.

grafik

A custom configuration in the Advanced Tab helped me out by providing the following configuration:

location = /  {
   proxy_pass                           http://172.50.1.99/admin;
   proxy_buffering                      off;
   proxy_set_header Host                $http_host;
   proxy_set_header X-Real-IP           $remote_addr;
   proxy_set_header X-Forwarded-For     $proxy_add_x_forwarded_for;
   proxy_set_header X-Forwarded-Proto   $scheme;
}
<!-- gh-comment-id:1075006859 --> @robinduerhager commented on GitHub (Mar 22, 2022): So i just discovered that when using this configuration: ![grafik](https://user-images.githubusercontent.com/18482238/159458776-aaa5e809-8a50-4ca6-a181-e37cd892e257.png) ![grafik](https://user-images.githubusercontent.com/18482238/159458810-83cae66c-a4a9-4952-bd73-108a2cb873e1.png) I can route to my pihole on the subpath `/admin`, by using `pihole.cluster.lan/quack`, but when using thecustom locations configuration down below, which should theoretically route me to the `/admin` subpath by using `pihole.cluster.lan`, it won't work. ![grafik](https://user-images.githubusercontent.com/18482238/159459027-d81fffa5-2fed-4551-84c1-b8cb8b7a73dd.png) A custom configuration in the `Advanced` Tab helped me out by providing the following configuration: ```nginx location = / { proxy_pass http://172.50.1.99/admin; proxy_buffering off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } ```
Author
Owner

@hugalafutro commented on GitHub (Apr 9, 2022):

So to be clear, you're wanting a proxy host for http://example.something.com/ to reverse proxy to an upstream http://192.168.0.1:8080/subfolder/ ?

I'm trying to achieve exactly this (as opposed to pretty much everybody else it would seem), any pointers how to go about it please? I have a guacamole server that comes up as 404 on hostname and serves the actual content on hostname/guacamole subfolder and for the life of me I can't figure out how to add a proxy to host like this. Thanks!

<!-- gh-comment-id:1094089410 --> @hugalafutro commented on GitHub (Apr 9, 2022): > So to be clear, you're wanting a proxy host for `http://example.something.com/` to reverse proxy to an upstream `http://192.168.0.1:8080/subfolder/` ? > I'm trying to achieve exactly this (as opposed to pretty much everybody else it would seem), any pointers how to go about it please? I have a guacamole server that comes up as 404 on hostname and serves the actual content on hostname/guacamole subfolder and for the life of me I can't figure out how to add a proxy to host like this. Thanks!
Author
Owner

@oywino commented on GitHub (Nov 28, 2022):

So to be clear, you're wanting a proxy host for http://example.something.com/ to reverse proxy to an upstream http://192.168.0.1:8080/subfolder/ ?

This might have to be a new type of advanced proxy host as far as the UI is concerned.

So, just to be clear; Does your answer imply that achieving this is currently not possible with NPM v2.9.19 ?

<!-- gh-comment-id:1329759045 --> @oywino commented on GitHub (Nov 28, 2022): > So to be clear, you're wanting a proxy host for `http://example.something.com/` to reverse proxy to an upstream `http://192.168.0.1:8080/subfolder/` ? > > This might have to be a new type of advanced proxy host as far as the UI is concerned. So, just to be clear; Does your answer imply that achieving this is currently not possible with NPM v2.9.19 ?
Author
Owner

@IceflowRE commented on GitHub (Feb 1, 2023):

Just want to throw in, that this would also mean to change the access for each subfolder?

<!-- gh-comment-id:1412103353 --> @IceflowRE commented on GitHub (Feb 1, 2023): Just want to throw in, that this would also mean to change the access for each subfolder?
Author
Owner

@HippyCraig commented on GitHub (Apr 11, 2023):

So I was sort of able to get this to work using the rewrite under the cog for that I was watching the config files that NPM writes out and it creates a server block for this so you just need to add what you want to it, see below:

I got this working with a simple hello world container and it runs fine, but I wanted to have one of the sub directories go to a portainer portal and one going to NPM admin tool, wanted to create an internal website that would host all my configurations inside the network, this wouldnt be exposed based on access controls.

in my example it would be internal.somename.com I ws trying to go for a /npm and /portainer but I get bad gateway errors in the log, but if I find a path that points to the icon for npm that load if I directly add that to my path like this

http://internal.somename.com/proxymanager/images/favicons/favicon-16x16.png

image

<!-- gh-comment-id:1502538959 --> @HippyCraig commented on GitHub (Apr 11, 2023): So I was sort of able to get this to work using the rewrite under the cog for that I was watching the config files that NPM writes out and it creates a server block for this so you just need to add what you want to it, see below: I got this working with a simple hello world container and it runs fine, but I wanted to have one of the sub directories go to a portainer portal and one going to NPM admin tool, wanted to create an internal website that would host all my configurations inside the network, this wouldnt be exposed based on access controls. in my example it would be internal.somename.com I ws trying to go for a /npm and /portainer but I get bad gateway errors in the log, but if I find a path that points to the icon for npm that load if I directly add that to my path like this http://internal.somename.com/proxymanager/images/favicons/favicon-16x16.png ![image](https://user-images.githubusercontent.com/17074456/231028450-e59ddbc7-5bec-4886-aa52-9f5f51364c23.png)
Author
Owner

@quux-aivar commented on GitHub (Jul 14, 2023):

Problem

This thread is kinda confusing.

Lets define the goal correctly:

On Details we have

mydomain.com -> http://10.20.30.50:8080

For Custom Locations we want to achieve

mydomain.com/dir-first -> http://10.20.30.50:8081

If to add into Custom Location for mydomain.com/dir-first -> http://10.20.30.50:8081

Location:	/dir-fist
Scheme:		http
Hostname:	10.20.30.50
Port:		8081

this does not work.

How to configure?

What is the proper way for configuration that we could achieve:

https://mydomain.com/dir-first -> http://10.20.30.50:8081

including that

mydomain.com/dir-first/something else goes http://10.20.30.50:8081/something

or

mydomain.com/dir-first/something?queryvar=abc else goes http://10.20.30.50:8081?queryvar=abc

<!-- gh-comment-id:1636012376 --> @quux-aivar commented on GitHub (Jul 14, 2023): ## Problem This thread is kinda confusing. Lets define the goal correctly: On **Details** we have ``` mydomain.com -> http://10.20.30.50:8080 ``` For Custom Locations we want to achieve ``` mydomain.com/dir-first -> http://10.20.30.50:8081 ``` If to add into **Custom Location** for `mydomain.com/dir-first -> http://10.20.30.50:8081` ``` Location: /dir-fist Scheme: http Hostname: 10.20.30.50 Port: 8081 ``` this does not work. ## How to configure? What is the proper way for configuration that we could achieve: ``` https://mydomain.com/dir-first -> http://10.20.30.50:8081 ``` including that `mydomain.com/dir-first/something` else goes `http://10.20.30.50:8081/something` or `mydomain.com/dir-first/something?queryvar=abc` else goes `http://10.20.30.50:8081?queryvar=abc`
Author
Owner

@quux-aivar commented on GitHub (Jul 14, 2023):

Testing

Testing shows that NXPM generates these lines automatically for custom location in location /dir-first {:

    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_set_header X-Real-IP		$remote_addr;
    proxy_pass       http://10.20.30.50:8081;
<!-- gh-comment-id:1636053777 --> @quux-aivar commented on GitHub (Jul 14, 2023): ## Testing Testing shows that NXPM generates these lines automatically for custom location in `location /dir-first {`: ``` proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://10.20.30.50:8081; ```
Author
Owner

@tmzg0000 commented on GitHub (Jul 15, 2023):

I'm facing a similar issue and I'm looking for a simple setup to handle custom path proxying instead of subdomain proxying.

<!-- gh-comment-id:1636714844 --> @tmzg0000 commented on GitHub (Jul 15, 2023): I'm facing a similar issue and I'm looking for a simple setup to handle custom path proxying instead of subdomain proxying.
Author
Owner

@quux-aivar commented on GitHub (Jul 15, 2023):

I'm facing a similar issue and I'm looking for a simple setup to handle custom path proxying instead of subdomain proxying.

It appears that using subfolders for proxing is more difficult. The fundamental issue is that most apps do not support subdirectories on their own. For example, Nginx Proxy Manager is designed in such a way that it cannot be operated in a subfolder. The only solution is to utilise complex redirecting, but dealing with redirects for POST is pretty difficult. I almost got Nginx Proxy Manager to work in subfolder, but it still fails partially, as it utilises some form of path generation.

If you design your own programmes to adequately support it, you can use subfolders proxing. As containerisation has become a standard, developers who ship their apps as container images must also enable subfolder proxing.

<!-- gh-comment-id:1636800187 --> @quux-aivar commented on GitHub (Jul 15, 2023): > I'm facing a similar issue and I'm looking for a simple setup to handle custom path proxying instead of subdomain proxying. It appears that using **subfolders for proxing** is more difficult. The fundamental issue is that most apps do not support subdirectories on their own. For example, Nginx Proxy Manager is designed in such a way that it cannot be operated in a subfolder. The only solution is to utilise complex redirecting, but dealing with redirects for POST is pretty difficult. I almost got Nginx Proxy Manager to work in subfolder, but it still fails partially, as it utilises some form of path generation. If you design your own programmes to adequately support it, you can use subfolders proxing. As containerisation has become a standard, developers who ship their apps as container images must also enable subfolder proxing.
Author
Owner

@RexYuan commented on GitHub (Sep 6, 2023):

Any update on this?
I would love to have

mydomain.com -> 10.20.30.50:80
mydomain.com/app1 -> 10.20.30.50:81
mydomain.com/app2 -> 10.20.30.50:82
<!-- gh-comment-id:1708898331 --> @RexYuan commented on GitHub (Sep 6, 2023): Any update on this? I would love to have ``` mydomain.com -> 10.20.30.50:80 mydomain.com/app1 -> 10.20.30.50:81 mydomain.com/app2 -> 10.20.30.50:82 ```
Author
Owner

@quux-aivar commented on GitHub (Sep 6, 2023):

Any update on this? I would love to have

mydomain.com -> 10.20.30.50:80
mydomain.com/app1 -> 10.20.30.50:81
mydomain.com/app2 -> 10.20.30.50:82

@RexYuan, I wanted the same.

Actually it’s sometimes too complicated or even impossible to achieve. The easiest option is:

mydomain.com -> 10.20.30.50:80
mydomain.com/app1 -> 10.20.30.50:81/app1
mydomain.com/app2 -> 10.20.30.50:82/app2

This kind of configuration works flawlessly. On other cases you have to create complicated custom rewriting rules. POST request are the most complicated to handle.

<!-- gh-comment-id:1708956057 --> @quux-aivar commented on GitHub (Sep 6, 2023): > Any update on this? I would love to have > > ``` > mydomain.com -> 10.20.30.50:80 > mydomain.com/app1 -> 10.20.30.50:81 > mydomain.com/app2 -> 10.20.30.50:82 > ``` @RexYuan, I wanted the same. Actually it’s sometimes too complicated or even impossible to achieve. The easiest option is: ``` mydomain.com -> 10.20.30.50:80 mydomain.com/app1 -> 10.20.30.50:81/app1 mydomain.com/app2 -> 10.20.30.50:82/app2 ``` This kind of configuration works flawlessly. On other cases you have to create complicated custom rewriting rules. POST request are the most complicated to handle.
Author
Owner

@MickMorley commented on GitHub (Jan 20, 2024):

I have a working solution. @HippyCraig figured it out.

Using a test:

st.mydomain.com -> 10.0.0.10:8384
st.mydomain.com\one -> 10.0.0.11:8384

Under Custom Locations
You will have

location -> /one/
http -- 10.0.0.11 -- 8384

Click the gear and add:

rewrite /one(.*) $1 break;
#below  is used for Syncthing, not sure what it does or if its needed for you
proxy_hide_header Authorization;

Under Advanced add

location /one {
    return 301 $scheme://$host/one/;
}

What I have is, syncthing on my NAS is located at st.mydomain.com and my PCs on my network are nested under the Subfolder proxy conf at st.mydomain.com/one, st.mydomain.com/two etc.

<!-- gh-comment-id:1901531485 --> @MickMorley commented on GitHub (Jan 20, 2024): I have a working solution. @HippyCraig figured it out. Using a test: ``` st.mydomain.com -> 10.0.0.10:8384 st.mydomain.com\one -> 10.0.0.11:8384 ``` Under Custom Locations You will have ``` location -> /one/ http -- 10.0.0.11 -- 8384 ``` Click the gear and add: ``` rewrite /one(.*) $1 break; #below is used for Syncthing, not sure what it does or if its needed for you proxy_hide_header Authorization; ``` Under Advanced add ``` location /one { return 301 $scheme://$host/one/; } ``` What I have is, syncthing on my NAS is located at `st.mydomain.com` and my PCs on my network are nested under the Subfolder proxy conf at `st.mydomain.com/one`, `st.mydomain.com/two` etc.
Author
Owner

@HippyCraig commented on GitHub (Jan 20, 2024):

@MickMorley Cool when I get back from vacation I will give it a try, thanks for the help!!

<!-- gh-comment-id:1902166941 --> @HippyCraig commented on GitHub (Jan 20, 2024): @MickMorley Cool when I get back from vacation I will give it a try, thanks for the help!!
Author
Owner

@HippyCraig commented on GitHub (Jan 27, 2024):

@MickMorley I gave that a try and its not working for me, I even took away the proxy_hide_header Authorization; just to see if that was related and still nothing. I dont know if this just a limitation of how portainer works and it expects a specific sub directory off the root, other simple apps work fine. I even tried using the port 9000 in the url as thats what portainer expects still nothing. Im kinda stumped and may have to look at Trafik as an alternative.

Also the portal shows offline for that DNS entry and that extra code is removed its back online. Dont if that helps at all

<!-- gh-comment-id:1913306256 --> @HippyCraig commented on GitHub (Jan 27, 2024): @MickMorley I gave that a try and its not working for me, I even took away the proxy_hide_header Authorization; just to see if that was related and still nothing. I dont know if this just a limitation of how portainer works and it expects a specific sub directory off the root, other simple apps work fine. I even tried using the port 9000 in the url as thats what portainer expects still nothing. Im kinda stumped and may have to look at Trafik as an alternative. Also the portal shows offline for that DNS entry and that extra code is removed its back online. Dont if that helps at all
Author
Owner

@MickMorley commented on GitHub (Jan 28, 2024):

@MickMorley I gave that a try and its not working for me, I even took away the proxy_hide_header Authorization; just to see if that was related and still nothing. I dont know if this just a limitation of how portainer works and it expects a specific sub directory off the root, other simple apps work fine. I even tried using the port 9000 in the url as thats what portainer expects still nothing. Im kinda stumped and may have to look at Trafik as an alternative.

Also the portal shows offline for that DNS entry and that extra code is removed its back online. Dont if that helps at all

@HippyCraig, if you give me a quick idea on what your entry looks like I can give it a try. I have portainer on one or 2 PCs and can try to replicate your setup.

<!-- gh-comment-id:1913570972 --> @MickMorley commented on GitHub (Jan 28, 2024): > @MickMorley I gave that a try and its not working for me, I even took away the proxy_hide_header Authorization; just to see if that was related and still nothing. I dont know if this just a limitation of how portainer works and it expects a specific sub directory off the root, other simple apps work fine. I even tried using the port 9000 in the url as thats what portainer expects still nothing. Im kinda stumped and may have to look at Trafik as an alternative. > > Also the portal shows offline for that DNS entry and that extra code is removed its back online. Dont if that helps at all @HippyCraig, if you give me a quick idea on what your entry looks like I can give it a try. I have portainer on one or 2 PCs and can try to replicate your setup.
Author
Owner

@HippyCraig commented on GitHub (Jan 28, 2024):

I have a VM running Docker, that hosts NPM container and Portainer all on the one Virtual Server running in Proxmox.

Inside NPM
image

image

image

When this setup and I go back to the home of NPM I see this

image

<!-- gh-comment-id:1913618600 --> @HippyCraig commented on GitHub (Jan 28, 2024): I have a VM running Docker, that hosts NPM container and Portainer all on the one Virtual Server running in Proxmox. Inside NPM ![image](https://github.com/NginxProxyManager/nginx-proxy-manager/assets/17074456/83ea5434-1e0f-4f0d-94a5-ceba5d598d60) ![image](https://github.com/NginxProxyManager/nginx-proxy-manager/assets/17074456/9c97fc1d-9c64-43da-8083-ef6dc7de186b) ![image](https://github.com/NginxProxyManager/nginx-proxy-manager/assets/17074456/ed485734-ec59-4b20-9164-4386808c03b4) When this setup and I go back to the home of NPM I see this ![image](https://github.com/NginxProxyManager/nginx-proxy-manager/assets/17074456/a671f0b2-37fb-4b8d-b139-fb179d9e2385)
Author
Owner

@github-actions[bot] commented on GitHub (Sep 2, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2323632467 --> @github-actions[bot] commented on GitHub (Sep 2, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Sep 22, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:3316531145 --> @github-actions[bot] commented on GitHub (Sep 22, 2025): Issue was closed due to inactivity.
Author
Owner

@hagih commented on GitHub (Nov 18, 2025):

This would be really nice to have.......

<!-- gh-comment-id:3549253896 --> @hagih commented on GitHub (Nov 18, 2025): This would be really nice to have.......
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#39
No description provided.