skip to Main Content

I have 2 nginx pages, running on ports 80 and 81. I want to route port 80 to @ (A record -> Name: @, IPv4 address: 1.2.3.4) and port 81 to test.@ (A record -> Name: test.@, IPv4 address: 1.2.3.4:81), and an IPv4 address with a port is considered invalid. How can I route port 81 to port 80?

2

Answers


  1. I don’t think that this is possible on the Cloudflare side, I think you need to consider to use NGINX Reverse Proxy, as described here:
    How to create reverse proxy for multiple websites in nginx

    Login or Signup to reply.
  2. Its not possible to specify a port in an A record. The request will always go to the port the user typed in the web browser. To forward traffic from one port to another you need an reverse proxy. That being said, cloudflare dns is not their only product, you could use a cloudflare tunnel, it is limited in functionality compared to using nginx but if all you need is hosting a couple websites it should work perfectly. You will need to install cloudflared in the server.

    I dont understand what you mean by

    The reverse proxy answer included adding something to the CLIENT’s
    machine

    The nginx setup mentioned in the other answer is just a modification you would do to your current nginx configuration on the server. The cloudflare tunnels would work but they are not needed since you have a public IP address. I would recommend trying out Caddy, it serves the same purpose as nginx but I find it way easier to configure for this type of use case.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search