# Weird ReplacePath issue

**URL:** <https://community.traefik.io/t/weird-replacepath-issue/27682>\
**Category:** Traefik v3 (latest)\
**Tags:** docker-swarm, middleware\
**Created:** [June 4, 2025, 12:57pm UTC](https://community.traefik.io/t/weird-replacepath-issue/27682 "2025-06-04T12:57:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deanski](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@Deanski](https://community.traefik.io/u/Deanski)\
**Post date:** [June 4, 2025, 12:57pm UTC](https://community.traefik.io/t/weird-replacepath-issue/27682/1 "2025-06-04T12:57:25Z")

</div>

Hello guys,

I've got very weird issue with Replacepath option that I couldn't find the solution and I hope some one had similar issue so I can fix this.

So I've got a custom written nodejs application that I cannot modify its code. And the issue is following. I am trying to replace path based on pathprefix:

traefik.http.routers.mm.rule=PathPrefix(`/566kkkdhhu3`)  
traefik.http.routers.mm.middlewares=mw  
traefik.http.middlewares.mw.replacepath.path=/someurl?id=100

Tried to escape the "?" in the url - did not help. At first, I thought I hit a bug within Traefik.  
But, I started a basic nginx container to see what is actiually the rewrite and saw this - the url is fine, with one exception - "?" is decoded as %3F and path looks like this:

/someurl%3Fid=100

Which in my case return an error as the url is checked internally in the docker container by some NodeJS application - the app expects EXACT match and does not accept %3F as "?"

Is there any way to fix this and pass "?" as is?

I also tried with Replacepathregex, but I couldn't get it working despite regex101 and go playground said regex is OK.., probably my fault though.

Also, TRACE logs does not show anything unusual.

Kind Regards,  
Dean

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 4, 2025, 1:54pm UTC](https://community.traefik.io/t/weird-replacepath-issue/27682/2 "2025-06-04T13:54:16Z")

</div>

The behavior is not documented in the [doc](https://doc.traefik.io/traefik/middlewares/http/replacepath/). I tested it, both `ReplacePath` and `ReplacePathRegex` seem to do URL encoding. Maybe there should be an option to disable encoding.

If you think this is a missing feature or bug, you could tell the devs at [Traefik Github](https://github.com/traefik/traefik).
