Uri Klar
Uri Klar

Reputation: 3988

AWS Lightsail - disable direct access to static ip

I have a wordpress website hosted on AWS Lightsail. I added an A record to my DNS pointing my custom domain to the static ip of the Lightsail instance.

But, I don't want the website to be accessible via the static ip, only via my custom domain.

How can I block access to the static ip?
Thanks!

Upvotes: 3

Views: 2106

Answers (1)

Chris Williams
Chris Williams

Reputation: 35146

As your domain name is resolving to the IP address the IP address will still need to allow ingress into the IP.

For this reason the change will need to happen within the host.

Depending on the web server technology you are using (such as Apache or Nginx) the first host file that loads is served if no other host configuration is matched.

If you add the secondary vhost for your domain ensuring you explicitly reference the domain, then in the default host rather than serving your application return a 403 instead this will prevent bypassing your domain name.

More information is available in the following links:

Upvotes: 2

Related Questions