NginxProxyManager / NginxProxyManager/nginx-proxy-manager

Unable to correctly serve sub-paths using Nginx Proxy Manager

Open
#4,102 20 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
34.2k
Forks
3.9k
Avg merge
21h 12m
Merged PRs (30d)
20

Description

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • Yes
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug
I am trying to set up services under sub-paths (e.g., https://mydomain.com/service1) using Nginx Proxy Manager (NPM). While subdomains work fine (e.g., service1.mydomain.com), sub-paths don’t seem to function correctly.

For example, I have configured https://mydomain.com/proxy to forward requests to http://nginx-proxy-manager:81, but when trying to access the service, the resources (CSS, JS, etc.) are still being requested from the root path (https://mydomain.com/) instead of https://mydomain.com/proxy/.

I have tried using custom locations, sub_filter, and proxy_redirect configurations, but the resources are not loading properly from the sub-path.

This issue seems to be similar to what others have experienced in discussion #1288 and this Reddit post, where sub-path forwarding doesn’t work as expected in NPM.

Nginx Proxy Manager Version
v2.11.3

To Reproduce
Steps to reproduce the behavior:

  1. Create a proxy host for https://mydomain.com/proxy.
  2. Set it to forward to http://nginx-proxy-manager:81.
  3. Access https://mydomain.com/proxy in the browser.
  4. Check the console for resource loading errors (404 Not Found).

Expected behavior
Resources (CSS, JS, etc.) should load from https://mydomain.com/proxy/ and not from the root path.

Screenshots

截圖 2024-10-23 凌晨1 03 40

This works.

截圖 2024-10-23 凌晨1 02 38

But this doesn't work.

Operating System
Docker on Linux

Additional context

  • I have tested this with custom locations in NPM.
  • Also tried adding sub_filter rules in Nginx to rewrite resource URLs and using proxy_redirect to ensure any backend redirects retain the /proxy prefix.
  • Subdomains work fine, but sub-paths present this issue.
  • Docker version 24.0.5, build ced0996

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Reproduce the proxy-host setup in the issue, inspect how Nginx handles /proxy and browser requests for CSS and JS, and compare it with the working subdomain case. Done means the proxied service and its assets load under /proxy/ without root-path 404s.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nginx
Domain
devops, infrastructure, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.