grunt-connect-proxy icon indicating copy to clipboard operation
grunt-connect-proxy copied to clipboard

Replacement for changeOrigin option?

Open derzwen opened this issue 10 years ago • 6 comments

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.

derzwen avatar Sep 01 '14 11:09 derzwen

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

ojna avatar Sep 01 '14 12:09 ojna

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.

lukeman avatar Sep 02 '14 04:09 lukeman

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 }, } ]

ltaupiac avatar Oct 13 '14 13:10 ltaupiac

@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!

enrico-querci avatar Dec 18 '14 13:12 enrico-querci

Thanks @TiTerm

SeyZ avatar Jan 11 '15 20:01 SeyZ

Thanks @TiTerm, you saved my day!

frozenluo avatar Mar 26 '15 08:03 frozenluo