Skip to content

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

Merged
merged 1 commit into from
Jun 24, 2015
Merged

added support for regex path and rewrite in proxy options #187

merged 1 commit into from
Jun 24, 2015

Conversation

ntharim
Copy link
Contributor

@ntharim ntharim commented May 26, 2015

Fix of #148.

@rafaelchiti
Copy link

@sokra is there intentions to merge this in? just to know since I'll be needing it.
Thanks!

@wmertens
Copy link

This is great!

@sokra please merge 😁

return {
path: path,
target: typeof options.proxy[path] === "string" ? options.proxy[path] : options.proxy[path].target
};
Copy link
Member

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.

Copy link
Contributor Author

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...)?

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

sokra added a commit that referenced this pull request Jun 24, 2015
added support for regex path and rewrite in proxy options
@sokra sokra merged commit dad0612 into webpack:master Jun 24, 2015
@sokra
Copy link
Member

sokra commented Jun 24, 2015

Thanks

@jokull
Copy link

jokull commented Jul 4, 2015

Should be noted this isn’t real regex support but path-to-regexp support. Took me a while to figure out 👻

@sokra
Copy link
Member

sokra commented Jul 5, 2015

@jokull You can send a PR to add these hint...

@kisenka
Copy link

kisenka commented Jul 17, 2015

Sorry, can you explain how to use this feature?

@ntharim
Copy link
Contributor Author

ntharim commented Jul 17, 2015

@kisenka Please see #148 for example usage. There are more examples in #127 too.

@stevehu
Copy link

stevehu commented Aug 11, 2015

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.

@stevehu
Copy link

stevehu commented Aug 11, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants