-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
added support for regex path and rewrite in proxy options #187
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
Conversation
@sokra is there intentions to merge this in? just to know since I'll be needing it. |
This is great! @sokra please merge 😁 |
return { | ||
path: path, | ||
target: typeof options.proxy[path] === "string" ? options.proxy[path] : options.proxy[path].target | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be removed, because lib/Server.js does the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the whole if(options.proxy...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's just for console.log
. It's straight from #148, I'll just remove it then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
added support for regex path and rewrite in proxy options
Thanks |
Should be noted this isn’t real regex support but path-to-regexp support. Took me a while to figure out 👻 |
@jokull You can send a PR to add these hint... |
Sorry, can you explain how to use this feature? |
I want to proxy to my API server if uri is /api/rs to http://anotherhost:8080/api/rs. What would be my proxy configuration? I tried several examples and they are not working. Any help would be greatly appreciated. Some people post solutions that use express server to proxy to webpack-dev-server and I don't want to go that route. Thanks. |
Sorry. Please ignore my previous post as it is working now after upgrade to the latest webpack and webpack-dev-server. Thanks a lot for fixing it. |
Fix of #148.