Skip to content
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

Changing changeOrigin to be true by default #1132

Open
patrickallaert opened this issue Jan 19, 2017 · 3 comments
Open

Changing changeOrigin to be true by default #1132

patrickallaert opened this issue Jan 19, 2017 · 3 comments

Comments

@patrickallaert
Copy link

As mentioned by @bdefore and @kdepp in #851, changeOrigin should be set to true by default.

The very first reason is simply to be compatible with the HTTP 1.1 specifications that requires a Host header. If a proxy listen on foobar.com and proxies request to bargee.net, then every requests sent to bargee.net must have a Host header set: Host: bargee.net.
In turns, by fixing the inconsistencies generated by changeOrigin=false, it will enable all virtual host environment to serve request correctly. This is the case for example when using http-proxy via grunt-connect-proxy that even dropped support for changeOrigin and requires injecting forcefully the host header.

IMHO, it would even be better to get rid of that option completely and consider it is always true.

@raffy2010
Copy link

here's specs
rfc7230#section-5.4

@oxygen
Copy link

oxygen commented Aug 22, 2018

Many users of this library (including me) encounter this problem and need to set changeOrigin: true:

https://stackoverflow.com/questions/14262986/node-js-hostname-ip-doesnt-match-certificates-altnames/45579167#45579167

Not far fetched to say some are just giving up before finding out about the changeOrigin flag.

@oliverpool
Copy link

An approaching solution would be to improve the error message, to point to some documentation about this setting.

This is what I got:

[vite] http proxy error:
Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
    at TLSSocket.emit (node:events:394:28)
    at TLSSocket.emit (node:domain:475:12)
    at TLSSocket._finishInit (node:_tls_wrap:944:8)
    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)

which is not very helpful to find the solution (changeOrigin: true)

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

No branches or pull requests

4 participants