AireServ
By:
AireServ

How to spoof a only a directory of a website (e.g. example.com/spoof) via DNS

December 29, 2016 724 views
Nginx Apache DNS Ubuntu

DNS Spoofing is considered...bad. But that's only because people do not use it for good.

I am trying to block a directory of a website by spoofing it on my local DNS server. However, I do not want it to redirect. Here is an example of what I have done so far. The website shall remain unnamed for privacy.

http {

server {
    listen       80;
    server_name  example.com;

    location / {
        proxy_pass http://example.com/;
        proxy_set_header host $http_host;
        resolver 8.8.8.8;
    }

    location = /blocked/blocked.json
    root /dns/;
    autoindex on;
}

4 comments
  • Okay, it deleted the rest of my post. Here's the end:

    The directory of the website passes through the DNS and pulls up what it would without a DNS at all, however, the main directory of the website (example.com) throws a 500 internal server error.

    I am running this on Ubuntu with DNSMasq (DNS is set up properly).

  • A 500 error will result in details being logged to your error log. What is recorded in /var/log/nginx/error.log when the 500 error is returned?

  • @ryanpq I'm having trouble trying to reproduce the error as it is not in the error.log. However, the website isn't being affected anymore. It's as if nginx isn't running (but it is)

  • @ryanpq Just recreated it. Here's the error: http://pastebin.com/m06FDkDy

1 Answer
Have another answer? Share your knowledge.