Unable to do HTTPS on c9users.io (request could not be proxied)

server

#1

I can’t connect to my node server on its c9users.io domain via HTTPS. It works fine over HTTP and works over HTTPS when tested ‘internally’ (ie. using localhost), so I know my node server is fine, but when I try to use “https://******.c9users.io:8081” I get a web page with:

ECONNRESET: Request could not be proxied!

I’ve been using curl to try to figure out what is wrong with stuff like this (and many variations there-upon):

curl -v -k -H “Content-type: application/json; charset=UTF-8” -X POST --data “{ blah : ‘inblah’ }” https://******.c9users.io:8081/

But my server doesn’t get touched at all.

The verbose output looks good until I get to:


upload completely sent off: 19 out of 19 bytes
HTTP/1.1 503 Service Unavailable


#2

Turns out that the problem was that my app was listening on HTTPS, as well as HTTP (on different ports, of course).

Matthijs told me that c9users.io works as a proxy so I only need to listen on http even though I’m I’m trying to use HTTPS.

When I stopped listening on https, it worked fine (and this is fine for me since I don’t really need both http & https).


ECONNRESET: Request could not be proxied! and other errors
#3

Also, if in production you need HTTPS, you can use a proxy like Nginx to internally proxy requests over HTTPS.


#4

There must be a way to fix this without having to resort to using http??


#5

If it’s really a problem, create an Nginx reverse proxy in your workspace, where HTTP requests are internally proxied to your HTTPS server. To do so, just run your server on a random port like 2368 (common for internal servers) using 127.0.0.1 as the IP. Then, in your proxy configuration, use a proxy_pass to https://127.0.0.1:2368/, and listen externally on port 8080 with HTTP. For more information on reverse proxies, see https://www.nginx.com/resources/admin-guide/reverse-proxy/.


Too_many_redirects when using .htaccess
#6

the reverse nginx thing did the trick