drewzboto / grunt-connect-proxy

Grunt Connect support for proxying API calls during development
MIT License
424 stars 122 forks source link

Replacement for changeOrigin option? #72

Open derzwen opened 10 years ago

derzwen commented 10 years ago

The changeOrigin option was removed in 0.1.11 (worked fine in 0.1.10). Is there any replacement for this? How can i change the host header of the proxied request so that it matches the one from the original request? We need this functionality for our project to work properly.

BTW: Removing this option was not a minor change because it breaks existing functionalities which should not happen when increasing only the last digit of the version number. Instead, the 0.1.11 release should have been named 0.2.x because of this incompatible change.

ojna commented 10 years ago

+1 on this. Spent 2 days looking for errors because of 404 after installing 0.1.11

lukeman commented 10 years ago

The major version bump in the node-http-proxy dependency to support web sockets is at fault (it also broke SSL). That upstream project was completely rewritten, so it's not a drop-in replacement given the breaking changes.

ltaupiac commented 9 years ago

option ChangeOrigin should be replace now by header directive proxies: [ { context: '/path', host: 'myhost.go.to.com', port: 80, https: false, changeOrigin: true // <<<=== don't work anymore since 0.1.11 headers: { 'host': 'myhost.go.to.com' // <<<=== do what was done by ChangOrigin }, } ]

enrico-querci commented 9 years ago

@TiTerm with your suggestion

headers: { 'host': 'myhost.go.to.com' // <<<=== do what was done by ChangOrigin }

you made my day! I spent too many hours trying to resolve a 404 error, when all I needed was to add this simple line to my grunt.js file.

It should be clearly stated somewhere, none of the guides/tutorial on the web mention this :(

A HUGE thank you!

SeyZ commented 9 years ago

Thanks @TiTerm

frozenluo commented 9 years ago

Thanks @TiTerm, you saved my day!