PathPrefix with '#' in the rule

Hi,
I have a URL that has '#" in the path (https://localhost:8000/#/foo). When I keep the PathPrefix as '/#/foo', that does not passthrough (404). Is there is a different way that I can get it through? I tried with different escape case.
PathPrefix(/\\#/foo)
PathPrefix(/\#/foo)

Neither work. Any suggestions here are much appreciated.

Using V2.11.0

I don't think that the # part is included in the path.

URI = scheme ":" ["//" authority] path ["?" query] ["#" fragment]

Source: Wikipedia

Right,
But the React customized framework (HashRouter) that i use has the URLs generated with '#' (https://localhost:8000/#/foo). So, I am wondering if there is any way that I can pass through in the Traefikc Rules.

No, I don't think so.

Traefik will parse URLs according to standard rules, and parts after # are not path, but fragment.

You could open a feature request on Traefik Github to set an option to include a fragment in path or have a Fragment() and FragmentRegexp() matcher for rule. But I am not sure it will get implemented.

In favour of your feature request would be, that they already have an extra Query() and QueryRegexp() matcher, so it would just be fair to have the same for the fragment, too :smiley: Also implementation is probably easier with existing code for query.

1 Like