[novice]: Trying to setup reverse proxy from on Node.js app from port 3001 to 80 (without SSL)

1. Caddy version (caddy version):

v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=

2. How I run Caddy:

caddy reverse-proxy --from :80 --to :3001

a. System environment:

Windows 10, no Docker. Installed with chocolatey

b. Command:

caddy reverse-proxy --from :80 --to :3001

c. Service/unit/compose file:

Not using docker or other tools.

d. My complete Caddyfile or JSON config:

I am running it without a Caddyfile

3. The problem I’m having:

I have set up a Dynamic DNS with Namecheap’s DDNS Client(v2). Everything works fine when I try to access this app with the port but when I try to open the webpage directly on port 80, with the command running, I just can’t get it to work.

4. Error messages and/or full log output:

Error in the browser:

The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

Error in the terminal:

2021/06/20 21:19:57.896 ERROR   http.log.error  EOF     {"request": {"remote_addr": "", "proto": "HTTP/1.1", "method": "GET", "host": "localhost", "uri": "/", "headers": {"Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"], "Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-User": ["?1"], "User-Agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0"], "Accept-Language": ["en-US,en;q=0.5"], "Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "Sec-Fetch-Dest": ["document"], "Cache-Control": ["max-age=0"]}}, "duration": 0.0009988, "status": 502, "err_id": "gsgy163sq", "err_trace": "reverseproxy.statusError (reverseproxy.go:857)"}

5. What I already tried:

I have tried contacting NameCheap support and asking for help from them(but nothing), read numerous posts on websites like Reddit, I have found a similar issue on GitHub but that sadly didn’t answer my problem.

6. Links to relevant resources:

Thanks for your time and effort.

Do you actually have a service running and listening to requests on port 3001, on that same machine? Caddy seems to not be able to connect to that service.

1 Like

Yes, I do and that’s the weirdest thing actually. Have tried doing it with other services too, seems to not work :frowning:

When proxying from port 33333001 it works. The only case when it doesn’t work is 80

Binding the program directly to port 80 doesn’t work either. Does this have to do something with my firewall? If yes, could you please guide me through the process of updating the rules?

Are you running Caddy as a user which has permissions to bind to low ports? On Windows, you might need to run caddy as an administrator/privileged user.

Really? Let me try running it with an elevated command prompt. Thanks for the suggestion.

Nope, still nothing. I can’t access it but when I run netstat -ano my process is bidden correctly to the required port here are the lines:


TCP    [::]:80                [::]:0                 LISTENING       14932

Node.js Server:

 TCP    [::]:3001              [::]:0                 LISTENING       8016

Here’s the screen that I get from Firefox(Developer Edition. Latest version):

This topic was automatically closed after 30 days. New replies are no longer allowed.