grunt-connect-proxy
grunt-connect-proxy copied to clipboard
Getting 400 Bad request: "You're speaking plain HTTP to an SSL-enabled server port." error.
Hi!
I have some configuration issues on OSX Mavericks: if I try to proxy some requests to https server then I get 400 Bad request. Here is the full message:
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
I thought that if I set https option to true then the proxy will handle it. I also configured the client app server to use SSL connection and even this will result the same error:
Here is my configuration:
module.exports = {
nodePort: 3000,
dataSource: 'proxy',
proxy: {
proxies: [
{
context: '/test',
host: 'localserver.lan',
port: 443,
https: true,
changeOrigin: false
}
]
}
};
+1
Same issue
Roll back to 0.1.10 which doesn't have this issue.
+1
Can also confirm this is a regression from 0.1.10
+1
Also a problem on Ubuntu 14.04; 0.1.10 works as expected.
+1
+1
I'm also affected by this, can't rollback to 0.1.10 because then my wss proxy doesn't work. I found this line https://github.com/drewzboto/grunt-connect-proxy/blob/master/tasks/connect_proxy.js#L53 and the next to be a bit odd. The target should have a protocol, and secure is only about certificate validation (in the case you want to mitm the https). Maybe this changed from previous versions of http-proxy, but I think for HTTP->HTTPS proxying you only need to have a https:// target.
+1
+1 Reverted to 0.1.10 - no issues there.
On Ubuntu 14.04.
Has anyone forked and fixed this issue?
+1
The dude made a new version 14 days ago (after almost a year) and didn't fix this?
@iamchairs Feel free to send in a PR.
The new version was to fix people build which were broken.
When will this be addressed?
@SpearThruster This was mentioned October 14th. I'm guessing it won't be. We've moved to gulp and no longer have these problems.
I dug through the source code and found a simple fix:
To your proxy configuration, add protocol: 'https:'
. I think I'll send a PR documenting this configuration option.
Just ran into this, lost a half-hour before finding @minznerjosh's workaround. Works great, much appreciated.
@drewzboto Thoughts on the workaround above? Can we get this fixed? I am available to provide any additional details as desired.
Looking through the changes between v0.2.0 and v0.1.10 I found this line:
server: httpProxy.createProxyServer({
// ...
secure: proxyOption.https
// ...
})
In short, I got http => https proxying to work by setting my config like so:
{
https: false,
protocol: 'https:'
}
Doing it that way let me proxy my UI's api requests from http://localhost:9000/api to my api at https://localhost:8443/api. I hope that helps someone else.
:+1: on this! seriously, it sucks!
Using "grunt-connect-proxy": "0.2.0", was getting The plain HTTP request was sent to HTTPS port
while proxying to https.
{
https: false,
protocol: 'https:'
}
Did the job for me.
+1 Could this please be fixed or at least be document??
Thanks @minznerjosh @mrDarcyMurphy for the solution!
same issue. while generating let'sencrypt certificate for my domain. How to solve this?