[GH-ISSUE #631] Use relative paths instead of absolute ones in frontend - run frontend on host/subdirectory #534

Closed
opened 2026-02-26 06:33:17 +03:00 by kerem · 12 comments
Owner

Originally created by @gf78 on GitHub (Oct 5, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/631

I would like to make the admin frontend available from outside, but do not use a own subdomain therefore.
I'd like to run it behind my.domain.com/nginxproxymanager/.

Because in the frontend all ressources are loaded with absolut urls this is not possible.

Originally created by @gf78 on GitHub (Oct 5, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/631 I would like to make the admin frontend available from outside, but do not use a own subdomain therefore. I'd like to run it behind my.domain.com/nginxproxymanager/. Because in the frontend all ressources are loaded with absolut urls this is not possible.
kerem 2026-02-26 06:33:17 +03:00
Author
Owner

@danielriddell21 commented on GitHub (Feb 7, 2021):

Hey @gf78 , did some digging. We can use sub filters to fix this, i used the below:

proxy_set_header Accept-Encoding "";
sub_filter 'href="/' 'href="/app/nginx/';
sub_filter 'src="/' 'src="/app/nginx/';
sub_filter 'window.location="/' 'window.location="/app/nginx/';
sub_filter_once off;
sub_filter_types text/css text/javascript;

<!-- gh-comment-id:774675201 --> @danielriddell21 commented on GitHub (Feb 7, 2021): Hey @gf78 , did some digging. We can use sub filters to fix this, i used the below: > proxy_set_header Accept-Encoding ""; > sub_filter 'href="/' 'href="/app/nginx/'; > sub_filter 'src="/' 'src="/app/nginx/'; > sub_filter 'window.location="/' 'window.location="/app/nginx/'; > sub_filter_once off; > sub_filter_types text/css text/javascript;
Author
Owner

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

Is there a webpack plugin which can do this at compile-time?

<!-- gh-comment-id:840019894 --> @chaptergy commented on GitHub (May 12, 2021): Is there a webpack plugin which can do this at compile-time?
Author
Owner

@finalsolarflare commented on GitHub (Nov 17, 2021):

Hey @gf78 , did some digging. We can use sub filters to fix this, i used the below:

proxy_set_header Accept-Encoding "";
sub_filter 'href="/' 'href="/app/nginx/';
sub_filter 'src="/' 'src="/app/nginx/';
sub_filter 'window.location="/' 'window.location="/app/nginx/';
sub_filter_once off;
sub_filter_types text/css text/javascript;

This really helped me as a starting point to figuring out how to proxy port 81 to /nginx-proxy/

So instead of http://example.com:81 I can use http://example.com/nginx-proxy

In case anyone else stumbles on this issue, this is how I got it to function:
I couldn't get a Custom Location to work, so under Proxy Host > Advanced
replace IP with your own IP, replace nginx-proxy with your desired location.

Disclaimer - there are probably things in there that aren't needed, and the script sub_filters will probably break when the js is minified in a future update.

location /nginx-proxy/ {
proxy_pass http://192.168.1.210:81/;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;

proxy_set_header Accept-Encoding "";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/nginx-proxy/';
sub_filter 'src="/' 'src="/nginx-proxy/';
sub_filter '/api' '/nginx-proxy/api';
sub_filter '/assets' '/nginx-proxy/assets';
# script changes
sub_filter 'r.p="/' 'r.p="/nginx-proxy/';
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginx-proxy/"})';
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginx-proxy","").';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;
}
<!-- gh-comment-id:971855438 --> @finalsolarflare commented on GitHub (Nov 17, 2021): > Hey @gf78 , did some digging. We can use sub filters to fix this, i used the below: > > > proxy_set_header Accept-Encoding ""; > > sub_filter 'href="/' 'href="/app/nginx/'; > > sub_filter 'src="/' 'src="/app/nginx/'; > > sub_filter 'window.location="/' 'window.location="/app/nginx/'; > > sub_filter_once off; > > sub_filter_types text/css text/javascript; This really helped me as a starting point to figuring out how to proxy port 81 to /nginx-proxy/ So instead of `http://example.com:81` I can use `http://example.com/nginx-proxy` In case anyone else stumbles on this issue, this is how I got it to function: I couldn't get a Custom Location to work, so under `Proxy Host > Advanced` replace IP with your own IP, replace `nginx-proxy` with your desired location. **Disclaimer** - there are probably things in there that aren't needed, and the script sub_filters will probably break when the js is minified in a future update. ``` location /nginx-proxy/ { proxy_pass http://192.168.1.210:81/; proxy_http_version 1.1; proxy_redirect off; proxy_set_header Upgrade $http_upgrade; proxy_cache_bypass $http_upgrade; proxy_set_header Connection $http_connection; proxy_cache_bypass $http_secret_header; proxy_set_header Accept-Encoding ""; add_header Pragma "no-cache"; add_header Cache-Control "no-cache"; # source changes sub_filter 'href="/' 'href="/nginx-proxy/'; sub_filter 'src="/' 'src="/nginx-proxy/'; sub_filter '/api' '/nginx-proxy/api'; sub_filter '/assets' '/nginx-proxy/assets'; # script changes sub_filter 'r.p="/' 'r.p="/nginx-proxy/'; sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginx-proxy/"})'; sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginx-proxy","").'; sub_filter_types text/css text/javascript application/javascript; sub_filter_once off; } ```
Author
Owner

@Aterfax commented on GitHub (Aug 23, 2022):

Hey @gf78 , did some digging. We can use sub filters to fix this, i used the below:

proxy_set_header Accept-Encoding "";
sub_filter 'href="/' 'href="/app/nginx/';
sub_filter 'src="/' 'src="/app/nginx/';
sub_filter 'window.location="/' 'window.location="/app/nginx/';
sub_filter_once off;
sub_filter_types text/css text/javascript;

This really helped me as a starting point to figuring out how to proxy port 81 to /nginx-proxy/

So instead of http://example.com:81 I can use http://example.com/nginx-proxy

In case anyone else stumbles on this issue, this is how I got it to function: I couldn't get a Custom Location to work, so under Proxy Host > Advanced replace IP with your own IP, replace nginx-proxy with your desired location.

Disclaimer - there are probably things in there that aren't needed, and the script sub_filters will probably break when the js is minified in a future update.

location /nginx-proxy/ {
proxy_pass http://192.168.1.210:81/;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;

proxy_set_header Accept-Encoding "";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/nginx-proxy/';
sub_filter 'src="/' 'src="/nginx-proxy/';
sub_filter '/api' '/nginx-proxy/api';
sub_filter '/assets' '/nginx-proxy/assets';
# script changes
sub_filter 'r.p="/' 'r.p="/nginx-proxy/';
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginx-proxy/"})';
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginx-proxy","").';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;
}

Anyone got an updated version of this?

<!-- gh-comment-id:1224982940 --> @Aterfax commented on GitHub (Aug 23, 2022): > > Hey @gf78 , did some digging. We can use sub filters to fix this, i used the below: > > > proxy_set_header Accept-Encoding ""; > > > sub_filter 'href="/' 'href="/app/nginx/'; > > > sub_filter 'src="/' 'src="/app/nginx/'; > > > sub_filter 'window.location="/' 'window.location="/app/nginx/'; > > > sub_filter_once off; > > > sub_filter_types text/css text/javascript; > > This really helped me as a starting point to figuring out how to proxy port 81 to /nginx-proxy/ > > So instead of `http://example.com:81` I can use `http://example.com/nginx-proxy` > > In case anyone else stumbles on this issue, this is how I got it to function: I couldn't get a Custom Location to work, so under `Proxy Host > Advanced` replace IP with your own IP, replace `nginx-proxy` with your desired location. > > **Disclaimer** - there are probably things in there that aren't needed, and the script sub_filters will probably break when the js is minified in a future update. > > ``` > location /nginx-proxy/ { > proxy_pass http://192.168.1.210:81/; > proxy_http_version 1.1; > proxy_redirect off; > proxy_set_header Upgrade $http_upgrade; > proxy_cache_bypass $http_upgrade; > proxy_set_header Connection $http_connection; > proxy_cache_bypass $http_secret_header; > > proxy_set_header Accept-Encoding ""; > add_header Pragma "no-cache"; > add_header Cache-Control "no-cache"; > # source changes > sub_filter 'href="/' 'href="/nginx-proxy/'; > sub_filter 'src="/' 'src="/nginx-proxy/'; > sub_filter '/api' '/nginx-proxy/api'; > sub_filter '/assets' '/nginx-proxy/assets'; > # script changes > sub_filter 'r.p="/' 'r.p="/nginx-proxy/'; > sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginx-proxy/"})'; > sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginx-proxy","").'; > sub_filter_types text/css text/javascript application/javascript; > sub_filter_once off; > } > ``` Anyone got an updated version of this?
Author
Owner

@Aterfax commented on GitHub (Aug 24, 2022):

Apparently I do.

location /nginx-proxy/ {
proxy_pass http://nginx-proxy-manager_app_1:81/;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;

proxy_set_header Accept-Encoding "";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/nginx-proxy/';
sub_filter 'src="/' 'src="/nginx-proxy/';
sub_filter '/api' '/nginx-proxy/api';
sub_filter '/assets' '/nginx-proxy/assets';
sub_filter '/js/' '/nginx-proxy/js/';
# script changes
sub_filter 'r.p="/' 'r.p="/nginx-proxy/';
sub_filter '"/login' '"/nginx-proxy/login';
sub_filter 'case"/logout"' 'case"/nginx-proxy/logout"';
sub_filter 'window.location="/"' 'window.location="/nginx-proxy/"';
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginx-proxy/"})';
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginx-proxy","").';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;
}

This appears to be functional but I give no warranty as my Javascript knowledge is paltry at best.

Disclaimer - there are probably things in there that aren't needed, and the script sub_filters will probably break when the js is minified in a future update.

This seems likely the cause. The minification also made it a total pain in the ass to find the above.

<!-- gh-comment-id:1225037973 --> @Aterfax commented on GitHub (Aug 24, 2022): Apparently I do. ``` location /nginx-proxy/ { proxy_pass http://nginx-proxy-manager_app_1:81/; proxy_http_version 1.1; proxy_redirect off; proxy_set_header Upgrade $http_upgrade; proxy_cache_bypass $http_upgrade; proxy_set_header Connection $http_connection; proxy_cache_bypass $http_secret_header; proxy_set_header Accept-Encoding ""; add_header Pragma "no-cache"; add_header Cache-Control "no-cache"; # source changes sub_filter 'href="/' 'href="/nginx-proxy/'; sub_filter 'src="/' 'src="/nginx-proxy/'; sub_filter '/api' '/nginx-proxy/api'; sub_filter '/assets' '/nginx-proxy/assets'; sub_filter '/js/' '/nginx-proxy/js/'; # script changes sub_filter 'r.p="/' 'r.p="/nginx-proxy/'; sub_filter '"/login' '"/nginx-proxy/login'; sub_filter 'case"/logout"' 'case"/nginx-proxy/logout"'; sub_filter 'window.location="/"' 'window.location="/nginx-proxy/"'; sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginx-proxy/"})'; sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginx-proxy","").'; sub_filter_types text/css text/javascript application/javascript; sub_filter_once off; } ``` This appears to be functional but I give no warranty as my Javascript knowledge is paltry at best. > > **Disclaimer** - there are probably things in there that aren't needed, and the script sub_filters will probably break when the js is minified in a future update. This seems likely the cause. The minification also made it a total pain in the ass to find the above.
Author
Owner

@Sphincz commented on GitHub (Oct 19, 2022):

Thank you very much @Aterfax !!!! 😄

This is the ultimate solution for those who want to have Nginx Proxy Manager Admin-UI behind other nginx proxy (raw).

Finally, after 48 hours of proxy_passing and regex rules that did not work, the solution from @Aterfax worked flawless for me!!!

Thank you very much once again!!!

<!-- gh-comment-id:1283769296 --> @Sphincz commented on GitHub (Oct 19, 2022): > Thank you very much @Aterfax !!!! 😄 This is the ultimate solution for those who want to have Nginx Proxy Manager Admin-UI behind other nginx proxy (raw). Finally, after 48 hours of proxy_passing and regex rules that did not work, the solution from @Aterfax worked flawless for me!!! Thank you very much once again!!!
Author
Owner

@chendelin1982 commented on GitHub (Nov 2, 2022):

I have test it, and found it need to add rewrite ^/nginxproxymanager/?(.*)$ /$1 break;

rewrite  ^/nginxproxymanager/?(.*)$ /$1 break;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;
proxy_set_header Accept-Encoding "";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/nginxproxymanager/';
sub_filter 'src="/' 'src="/nginxproxymanager/';
sub_filter '/api' '/nginxproxymanager/api';
sub_filter '/assets' '/nginxproxymanager/assets';
sub_filter '/js/' '/nginxproxymanager/js/';
# script changes
sub_filter 'r.p="/' 'r.p="/nginxproxymanager/';
sub_filter '"/login' '"/nginxproxymanager/login';
sub_filter 'case"/logout"' 'case"/nginxproxymanager/logout"';
sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"';
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})';
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;
<!-- gh-comment-id:1299462848 --> @chendelin1982 commented on GitHub (Nov 2, 2022): I have test it, and found it need to add `rewrite ^/nginxproxymanager/?(.*)$ /$1 break;` ``` rewrite ^/nginxproxymanager/?(.*)$ /$1 break; proxy_http_version 1.1; proxy_redirect off; proxy_set_header Upgrade $http_upgrade; proxy_cache_bypass $http_upgrade; proxy_set_header Connection $http_connection; proxy_cache_bypass $http_secret_header; proxy_set_header Accept-Encoding ""; add_header Pragma "no-cache"; add_header Cache-Control "no-cache"; # source changes sub_filter 'href="/' 'href="/nginxproxymanager/'; sub_filter 'src="/' 'src="/nginxproxymanager/'; sub_filter '/api' '/nginxproxymanager/api'; sub_filter '/assets' '/nginxproxymanager/assets'; sub_filter '/js/' '/nginxproxymanager/js/'; # script changes sub_filter 'r.p="/' 'r.p="/nginxproxymanager/'; sub_filter '"/login' '"/nginxproxymanager/login'; sub_filter 'case"/logout"' 'case"/nginxproxymanager/logout"'; sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"'; sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})'; sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").'; sub_filter_types text/css text/javascript application/javascript; sub_filter_once off; ```
Author
Owner

@Aterfax commented on GitHub (Nov 2, 2022):

I have test it, and found it need to add rewrite ^/nginxproxymanager/?(.*)$ /$1 break;

rewrite  ^/nginxproxymanager/?(.*)$ /$1 break;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;
proxy_set_header Accept-Encoding "";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/nginxproxymanager/';
sub_filter 'src="/' 'src="/nginxproxymanager/';
sub_filter '/api' '/nginxproxymanager/api';
sub_filter '/assets' '/nginxproxymanager/assets';
sub_filter '/js/' '/nginxproxymanager/js/';
# script changes
sub_filter 'r.p="/' 'r.p="/nginxproxymanager/';
sub_filter '"/login' '"/nginxproxymanager/login';
sub_filter 'case"/logout"' 'case"/nginxproxymanager/logout"';
sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"';
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})';
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;

Yep, that is to be expected as you have chosen the path /nginxproxymanager rather than /nginx-proxy

It may be worth "slugifying" this at some point but not right now for me as I am about to have a nap!

<!-- gh-comment-id:1299464956 --> @Aterfax commented on GitHub (Nov 2, 2022): > I have test it, and found it need to add `rewrite ^/nginxproxymanager/?(.*)$ /$1 break;` > > ``` > rewrite ^/nginxproxymanager/?(.*)$ /$1 break; > proxy_http_version 1.1; > proxy_redirect off; > proxy_set_header Upgrade $http_upgrade; > proxy_cache_bypass $http_upgrade; > proxy_set_header Connection $http_connection; > proxy_cache_bypass $http_secret_header; > proxy_set_header Accept-Encoding ""; > add_header Pragma "no-cache"; > add_header Cache-Control "no-cache"; > # source changes > sub_filter 'href="/' 'href="/nginxproxymanager/'; > sub_filter 'src="/' 'src="/nginxproxymanager/'; > sub_filter '/api' '/nginxproxymanager/api'; > sub_filter '/assets' '/nginxproxymanager/assets'; > sub_filter '/js/' '/nginxproxymanager/js/'; > # script changes > sub_filter 'r.p="/' 'r.p="/nginxproxymanager/'; > sub_filter '"/login' '"/nginxproxymanager/login'; > sub_filter 'case"/logout"' 'case"/nginxproxymanager/logout"'; > sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"'; > sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})'; > sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").'; > sub_filter_types text/css text/javascript application/javascript; > sub_filter_once off; > ``` Yep, that is to be expected as you have chosen the path `/nginxproxymanager` rather than `/nginx-proxy` It may be worth "slugifying" this at some point but not right now for me as I am about to have a nap!
Author
Owner

@bestK commented on GitHub (Dec 22, 2023):

我测试了一下,发现需要添加rewrite ^/nginxproxymanager/?(.*)$ /$1 break;

rewrite  ^/nginxproxymanager/?(.*)$ /$1 break;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;
proxy_set_header Accept-Encoding "";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/nginxproxymanager/';
sub_filter 'src="/' 'src="/nginxproxymanager/';
sub_filter '/api' '/nginxproxymanager/api';
sub_filter '/assets' '/nginxproxymanager/assets';
sub_filter '/js/' '/nginxproxymanager/js/';
# script changes
sub_filter 'r.p="/' 'r.p="/nginxproxymanager/';
sub_filter '"/login' '"/nginxproxymanager/login';
sub_filter 'case"/logout"' 'case"/nginxproxymanager/logout"';
sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"';
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})';
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;

location /npm/ {
	proxy_pass http://npm/;
	proxy_http_version 1.1;
	proxy_redirect off;
	proxy_set_header Upgrade $http_upgrade;
	proxy_cache_bypass $http_upgrade;
	proxy_set_header Connection $http_connection;
	proxy_cache_bypass $http_secret_header;
	proxy_set_header Accept-Encoding "";
	add_header Pragma "no-cache";
	add_header Cache-Control "no-cache";
	# source changes
	sub_filter 'content="/' 'content="/npm/';
	# fix href 
	sub_filter 'href="/logout' 'href="/npm/logout';
	sub_filter 'href="/css' 'href="/npm/css';
	sub_filter 'href="/image' 'href="/npm/image';
	
	sub_filter 'src="/' 'src="/npm/';
	sub_filter '/api' '/npm/api';
	sub_filter '/assets' '/npm/assets';
	sub_filter '/js/' '/npm/js/';
	# script changes
	sub_filter 'i.p+"js/"' 'i.p+"npm/js/"';
	sub_filter 'r.p="/' 'r.p="/npm/';
	sub_filter '"/login' '"/npm/login';
	sub_filter 'case"/logout"' 'case"/npm/logout"';
	sub_filter 'window.location="/"' 'window.location="/npm/"';
	sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/npm/"})';
	sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/npm","").';
	sub_filter_types text/css text/javascript application/javascript;
	 
	sub_filter_once off;

}

<!-- gh-comment-id:1867176796 --> @bestK commented on GitHub (Dec 22, 2023): > 我测试了一下,发现需要添加`rewrite ^/nginxproxymanager/?(.*)$ /$1 break;` > > ``` > rewrite ^/nginxproxymanager/?(.*)$ /$1 break; > proxy_http_version 1.1; > proxy_redirect off; > proxy_set_header Upgrade $http_upgrade; > proxy_cache_bypass $http_upgrade; > proxy_set_header Connection $http_connection; > proxy_cache_bypass $http_secret_header; > proxy_set_header Accept-Encoding ""; > add_header Pragma "no-cache"; > add_header Cache-Control "no-cache"; > # source changes > sub_filter 'href="/' 'href="/nginxproxymanager/'; > sub_filter 'src="/' 'src="/nginxproxymanager/'; > sub_filter '/api' '/nginxproxymanager/api'; > sub_filter '/assets' '/nginxproxymanager/assets'; > sub_filter '/js/' '/nginxproxymanager/js/'; > # script changes > sub_filter 'r.p="/' 'r.p="/nginxproxymanager/'; > sub_filter '"/login' '"/nginxproxymanager/login'; > sub_filter 'case"/logout"' 'case"/nginxproxymanager/logout"'; > sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"'; > sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})'; > sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").'; > sub_filter_types text/css text/javascript application/javascript; > sub_filter_once off; > ``` ``` location /npm/ { proxy_pass http://npm/; proxy_http_version 1.1; proxy_redirect off; proxy_set_header Upgrade $http_upgrade; proxy_cache_bypass $http_upgrade; proxy_set_header Connection $http_connection; proxy_cache_bypass $http_secret_header; proxy_set_header Accept-Encoding ""; add_header Pragma "no-cache"; add_header Cache-Control "no-cache"; # source changes sub_filter 'content="/' 'content="/npm/'; # fix href sub_filter 'href="/logout' 'href="/npm/logout'; sub_filter 'href="/css' 'href="/npm/css'; sub_filter 'href="/image' 'href="/npm/image'; sub_filter 'src="/' 'src="/npm/'; sub_filter '/api' '/npm/api'; sub_filter '/assets' '/npm/assets'; sub_filter '/js/' '/npm/js/'; # script changes sub_filter 'i.p+"js/"' 'i.p+"npm/js/"'; sub_filter 'r.p="/' 'r.p="/npm/'; sub_filter '"/login' '"/npm/login'; sub_filter 'case"/logout"' 'case"/npm/logout"'; sub_filter 'window.location="/"' 'window.location="/npm/"'; sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/npm/"})'; sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/npm","").'; sub_filter_types text/css text/javascript application/javascript; sub_filter_once off; } ```
Author
Owner

@github-actions[bot] commented on GitHub (Jul 8, 2024):

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

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

@github-actions[bot] commented on GitHub (Jul 21, 2025):

Issue was closed due to inactivity.

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

@Aterfax commented on GitHub (Jul 21, 2025):

Don't nuke this thread please. I suspect some folk may still want the code above.

<!-- gh-comment-id:3095074997 --> @Aterfax commented on GitHub (Jul 21, 2025): Don't nuke this thread please. I suspect some folk may still want the code above.
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#534
No description provided.