How do I redirect a domain's public ip address?

This is going to be a really dumb, silly question, but I haven’t been able to just find a straight answer to this.

How can I redirect my public ip address to my domain name?

I noticed that authentication with modules like Caddy Security can be bypassed if you just do a reverse dns look up and type in the public ip address of my server.

Like, if a person types in the public ip address of my server, they don’t be taken to my domain name, they will be simply arrive at the service hosted at my public ip.

If a person types in my public address, I would like it to just redirect them immediately to my authentication page instead.

I do have an A record for my domain and ip, btw. I should emphasize I know how to make dns records.

If you mean the requests are not going through Caddy on port 80 or 443, but directly to the port number your service is running on… then make sure you don’t port forward those other ports, or make sure the firewall blocks all incoming connections on those ports.

Caddy should be the only thing accepting HTTP requests in your network, and it will listen on ports 80 and 443 (80 for redirecting HTTP requests to HTTPS and for solving ACME challenges).

If that’s not the problem, then please fill out the help topic template. It’s impossible to help without seeing your config, logs, an example request using curl -v, etc. Click on New Topic, then pick the Help category, copy the template that’s prefilled in the text box and paste it into a comment in this topic, and fill it out.

1 Like

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