-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strip the pathPrefix from basic proxy requests #409
Conversation
Yup, that makes sense and matches what the http-proxy docs say about it |
Hi, @stramel Great to see how this feature is improving thanks to your recent PRs. Anyway, I'm not 100% sure that stripping the requestPath is enough. In my testing there are some inconsitencies you may have a look at. In case the js app makes this call "proxy": {
"/api": "http://localhost:5000",
// -> prefix removed, target localhost:5000 receives /status
"/api": "http://localhost:5000/some/other/path",
// -> request prefix removed but target path is not considered at all, maybe a bug
// -> target localhost:5000 still receives /status,
"/api": {
"target": "http://localhost:5000"
} ,
// -> no prefix stripping takes place and target receives full url /api/status
"/api": {
"target": "http://localhost:5000/api"
}
// -> no prefix stripping takes place and target path is considered
// -> target receives this /api/api/status
} I would check these individual cases if the intention is, for the most basic proxy configuration, to strip the prefix path from the request and add the path from the target. Would also weigh the upgrade case from the developers perspective when he want's to change a string configuration to a full options config. Ideally he would be able to migrate a simple config from Thanks!! Germán |
Thanks! 😄 As of now, I have been working to make the basic setup function similarly to how the proxy in the So going through your examples
Once you eject to an object config, we are deferring everything to you. It's pretty simple to do the proxy as you can see in this PR. Just add:
I suppose we probably could add that rewrite to all requests by default and require users to prepend the It looks like the second example isn't working properly, I can look into that.
I will have to defer to @FredKSchott on this. |
Yup, thanks for the summary @stramel, that all looks right. I'm +1 for not doing too much magic in the object use-case, I feel like it will confuse as many people as it would help (harder to trust the http-proxy README docs). |
Addresses issues that were brought up in #393
secure: false
back inignorePath: true
which strips the entire path of the request. Replaced it with a defaultproxyReq
event listener that just strips thepathPrefix
off the path.This will result in the URL going from
http://localhost:8080/storybook/static/js/bundle.js
->http://localhost:3000/static/js/bundle.js
which, I believe, was the intention of that config entry.For the advanced configs, I'm going to leave it as whatever you configure is what you get.
@FredKSchott
/cc @fcamblor