pathRewrite not matching regex pattern with variables
See original GitHub issueI am having an issue getting pathRewrite
to match a regex pattern in context
to variables in target
.
Expected behavior
It should map a regex pattern with expressions (e.g. (.*)
) to variables (e.g. $1
).
Actual behavior
Proxy is not being created and the Express route yields 404.
Setup
- http-proxy-middleware: ^0.18.0
- server: express@^4.16.3
proxy middleware configuration
proxy('/user/(.*)/posts/(.*)', {
pathRewrite: {
'^/user/(.*)/posts/(.*)': '/api/user/$1/posts/$2'
}
})
Is this functionality supported?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Developers - pathRewrite not matching regex pattern with variables -
I am having an issue getting pathRewrite to match a regex pattern in context to variables in target . Expected behavior. It should...
Read more >path-to-regexp not matching when passing arguments as ...
When I try to test if path-to-regexp will match a given path I will not get a result when expected, if I pass...
Read more >Regular expressions in paths - NGINX Ingress Controller
In NGINX, regular expressions follow a first match policy. In order to enable more accurate path matching, ingress-nginx first orders the paths by ......
Read more >Rewrites - next.config.js
To match a regex path you can wrap the regex in parenthesis after a parameter, for example /blog/:slug(\\d{1,}) will match /blog/123 but not...
Read more >Modify Outgoing Request Path - Akamai TechDocs
Perl compatible regular expression: Use this to specify match patterns you want ... With the Regular Expression Replacement option, format validation is not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will consider adding it if more users have to need for this.
+1