[GH-ISSUE #1584] rewrite directive is no longer working #1196

Closed
opened 2026-02-26 06:36:10 +03:00 by kerem · 16 comments
Owner

Originally created by @FarisZR on GitHub (Nov 13, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1584

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

the rewrite directive has no effect when put into the advanced tab
for example
rewrite ^/about$ /preferences last;
this works on LSIO SWAG, but doesn't work on NPM.

this issue started around the beginning of November, maybe something changed in OpenResty ? or a regression in v2.9.11+ ?

Nginx Proxy Manager Version

v2.9.12

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'any proxy host'
  2. Click on 'advanced'
  3. put a rewrite directive like rewrite ^/about$ /preferences last;
  4. test it and it won't work.

Expected behavior

the rewrite directive should work, and rewrite URLs as instructed.

Screenshots

Operating System

Debian 11/docker

Additional context

Originally created by @FarisZR on GitHub (Nov 13, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1584 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **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** <!-- A clear and concise description of what the bug is. --> the rewrite directive has no effect when put into the advanced tab for example `rewrite ^/about$ /preferences last;` this works on LSIO SWAG, but doesn't work on NPM. this issue started around the beginning of November, maybe something changed in OpenResty ? or a regression in v2.9.11+ ? **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> v2.9.12 **To Reproduce** Steps to reproduce the behavior: 1. Go to 'any proxy host' 2. Click on 'advanced' 3. put a rewrite directive like `rewrite ^/about$ /preferences last;` 4. test it and it won't work. **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> the rewrite directive should work, and rewrite URLs as instructed. **Screenshots** <!-- If applicable, add screenshots to help explain your problem. --> **Operating System** <!-- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error. --> Debian 11/docker **Additional context** <!-- Add any other context about the problem here, docker version, browser version, logs if applicable to the problem. Too much info is better than too little. -->
kerem 2026-02-26 06:36:10 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@chaptergy commented on GitHub (Nov 13, 2021):

I'm 90% certain this is due to the variables introduced for the proxy_pass a while ago. But due to other issues this introduced as well, it has been reverted. So this should be fixed when the next release comes. You can watch this repo at the top of the page to get notified when a new release is published. If your issue is not resolved in the next version, please comment on this issue again, and I will reopen it.

<!-- gh-comment-id:968112217 --> @chaptergy commented on GitHub (Nov 13, 2021): I'm 90% certain this is due to the variables introduced for the `proxy_pass` a while ago. But due to other issues this introduced as well, it has been [reverted](https://github.com/jc21/nginx-proxy-manager/pull/1578). So this should be fixed when the next release comes. You can watch this repo at the top of the page to get notified when a new release is published. If your issue is not resolved in the next version, please comment on this issue again, and I will reopen it.
Author
Owner

@FarisZR commented on GitHub (Nov 13, 2021):

Any ETA on the next release ?

-------- Original Message --------
On Nov. 13, 2021, 9:17 p.m., jc21/nginx-proxy-manager - reply+aipxadvzndne2bo773wtyun7tprd7evbnhhd5p34xu at reply.github.com wrote:

I'm 90% certain this is due to the variables introduced for the proxy_pass a while ago. But due to other issues this introduced as well, it has been reverted. So this should be fixed when the next release comes. You can watch this repo at the top of the page to get notified when a new release is published. If your issue is not resolved in the next version, please comment on this issue again, and I will reopen it.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

<!-- gh-comment-id:968113309 --> @FarisZR commented on GitHub (Nov 13, 2021): Any ETA on the next release ? -------- Original Message -------- On Nov. 13, 2021, 9:17 p.m., jc21/nginx-proxy-manager - reply+aipxadvzndne2bo773wtyun7tprd7evbnhhd5p34xu at reply.github.com wrote: > I'm 90% certain this is due to the variables introduced for the proxy_pass a while ago. But due to other issues this introduced as well, it has been [reverted](https://github.com/jc21/nginx-proxy-manager/pull/1578). So this should be fixed when the next release comes. You can watch this repo at the top of the page to get notified when a new release is published. If your issue is not resolved in the next version, please comment on this issue again, and I will reopen it. > > — > You are receiving this because you authored the thread. > Reply to this email directly, [view it on GitHub](https://github.com/jc21/nginx-proxy-manager/issues/1584#issuecomment-968112217), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AIPXADX4XNCJRMUVEZ3TKILUL2TT7ANCNFSM5H636SKA). > Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub).
Author
Owner

@chaptergy commented on GitHub (Nov 13, 2021):

No, since there have not been any other changes since the previous version it might still take some time. You could also use this docker image while waiting for the new version: jc21/nginx-proxy-manager:github-pr-1578

<!-- gh-comment-id:968114380 --> @chaptergy commented on GitHub (Nov 13, 2021): No, since there have not been any other changes since the previous version it might still take some time. You could also use this docker image while waiting for the new version: `jc21/nginx-proxy-manager:github-pr-1578`
Author
Owner

@FarisZR commented on GitHub (Nov 13, 2021):

i just tested the PR version, there is no difference, it still doesn't work.

i removed and added the proxy host again to make sure that the config file was reloaded

<!-- gh-comment-id:968125441 --> @FarisZR commented on GitHub (Nov 13, 2021): i just tested the PR version, there is no difference, it still doesn't work. i removed and added the proxy host again to make sure that the config file was reloaded
Author
Owner

@FarisZR commented on GitHub (Nov 14, 2021):

i just tried it with a new installation, same result.

<!-- gh-comment-id:968265464 --> @FarisZR commented on GitHub (Nov 14, 2021): i just tried it with a new installation, same result.
Author
Owner

@diwu1989 commented on GitHub (Nov 14, 2021):

Tried on the github-pr-1578 image and rewrites also dont work.
I have a wss custom location that sends /ws to a different port, and need to rewrite /ws to root /

<!-- gh-comment-id:968347930 --> @diwu1989 commented on GitHub (Nov 14, 2021): Tried on the `github-pr-1578` image and rewrites also dont work. I have a wss custom location that sends `/ws` to a different port, and need to rewrite `/ws` to root `/`
Author
Owner

@diwu1989 commented on GitHub (Nov 14, 2021):

From looking at the template, it looks like $forward_path get set into proxy_pass before any advanced location sections are added at the bottom of the template.

Wouldn't any rewrite rule need to be included at the very top?

<!-- gh-comment-id:968349502 --> @diwu1989 commented on GitHub (Nov 14, 2021): From looking at the template, it looks like `$forward_path` get set into `proxy_pass` before any advanced location sections are added at the bottom of the template. Wouldn't any rewrite rule need to be included at the very top?
Author
Owner

@FarisZR commented on GitHub (Nov 14, 2021):

From looking at the template, it looks like $forward_path get set into proxy_pass before any advanced location sections are added at the bottom of the template.

Wouldn't any rewrite rule need to be included at the very top?

you can edit the configs manually to see if this is the actual issue.
configs are located in /data/nginx.

i tried modifying the configs but nothing changed, it still doesn't work.

<!-- gh-comment-id:968352012 --> @FarisZR commented on GitHub (Nov 14, 2021): > From looking at the template, it looks like `$forward_path` get set into `proxy_pass` before any advanced location sections are added at the bottom of the template. > > Wouldn't any rewrite rule need to be included at the very top? you can edit the configs manually to see if this is the actual issue. configs are located in /data/nginx. i tried modifying the configs but nothing changed, it still doesn't work.
Author
Owner

@brtwrst commented on GitHub (Nov 20, 2021):

Can we please get a release for this?
Custom locations are completely broken for me and editing the settings manually every time does get old quick.

<!-- gh-comment-id:974611554 --> @brtwrst commented on GitHub (Nov 20, 2021): Can we please get a release for this? Custom locations are completely broken for me and editing the settings manually every time does get old quick.
Author
Owner

@FarisZR commented on GitHub (Nov 26, 2021):

Can we please get a release for this? Custom locations are completely broken for me and editing the settings manually every time does get old quick.

rewrites seem to work if you put the directive inside a location

for example

location /ex {
   rewrite ^/ex$ /page last; 
}
<!-- gh-comment-id:980334730 --> @FarisZR commented on GitHub (Nov 26, 2021): > Can we please get a release for this? Custom locations are completely broken for me and editing the settings manually every time does get old quick. rewrites seem to work if you put the directive inside a location for example ``` location /ex { rewrite ^/ex$ /page last; } ```
Author
Owner

@FarisZR commented on GitHub (Dec 24, 2021):

this is still not fixed btw.

and the work around i posted earlier doesn't always work

<!-- gh-comment-id:1000780795 --> @FarisZR commented on GitHub (Dec 24, 2021): this is still not fixed btw. and the work around i posted earlier doesn't always work
Author
Owner

@brtwrst commented on GitHub (Jan 4, 2022):

This seems fixed now.
I re-saved the configs that have custom locations and they all worked without having to manually edit the config files.

<!-- gh-comment-id:1004822685 --> @brtwrst commented on GitHub (Jan 4, 2022): This seems fixed now. I re-saved the configs that have custom locations and they all worked without having to manually edit the config files.
Author
Owner

@chaptergy commented on GitHub (Jan 4, 2022):

Great to hear, thanks for the feedback!

<!-- gh-comment-id:1005262147 --> @chaptergy commented on GitHub (Jan 4, 2022): Great to hear, thanks for the feedback!
Author
Owner

@FarisZR commented on GitHub (Jan 6, 2022):

I still can't get it to work. even on the latest release.
i tried it with rewrite ^/test$ /new last;

<!-- gh-comment-id:1006830664 --> @FarisZR commented on GitHub (Jan 6, 2022): I still can't get it to work. even on the latest release. i tried it with `rewrite ^/test$ /new last;`
Author
Owner

@timdonovanuk commented on GitHub (Aug 2, 2022):

This was working, then I updated to the latest version, and it's broken again.

<!-- gh-comment-id:1202305125 --> @timdonovanuk commented on GitHub (Aug 2, 2022): This was working, then I updated to the latest version, and it's broken again.
Author
Owner

@brtwrst commented on GitHub (Aug 2, 2022):

Can confirm that my custom locations are breaking after editing and re-saving. with the current :latest version
Made it work again by using the "add custom nginx config here at own risk" option of the custom locations.

<!-- gh-comment-id:1202744971 --> @brtwrst commented on GitHub (Aug 2, 2022): ~~Can confirm that my custom locations are breaking after editing and re-saving. with the current :latest version~~ Made it work again by using the "add custom nginx config here at own risk" option of the custom locations.
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#1196
No description provided.