Skip to content

Unable to correctly serve sub-paths using Nginx Proxy Manager #4102

@mcc311

Description

@mcc311

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions