Question

Redirect all the traffic not from my domain to 404

Someone is pointing their domain to our ip address, essentially cloning our website. After researching I came across that this is not issue with digitalocean or my droplet but rather I’d have to configure my nginx in a way that all traffic from domains other than mine are redirected to 404 or somewhere else.

I am not able to figure out how to do achieve that. Should I use map feature in nginx and if yes how does redirect from domain except mine works?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
July 12, 2022

Hi @swimmingaqualobster,

You don’t have power over Domains that are not under your configuration. It would be strange to have a domain being pointed at your Droplet as it shouldn’t work, there would be no Nginx config file for it and thus your Droplet wouldn’t know how to load it.

Can you please explain a little bit more about the situation in order to help you out properly? Thanks and looking forward to your reply!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up