pi-hole / pi-hole

A black hole for Internet advertisements
https://pi-hole.net
Other
49.25k stars 2.7k forks source link

Potential DNS forwarding (301) issue -- "redirected you too many times." #1725

Closed harrypnyce closed 7 years ago

harrypnyce commented 7 years ago

In raising this issue, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your issue:

I'm unsure if this is a potential duplicate: https://github.com/pi-hole/pi-hole/wiki/FAQs#can-i-redirect-a-domain-to-a-different-domain-333 However, i'm not trying to redirect via Pi-hole, i'm using GoDaddy's Domain Forwarding (301) which seems to have caused the problem.

How familiar are you with the codebase?: [2] Not super familiar, however i have submitted help requests using pihole debug mode previously.

[BUG REPORT | OTHER]:

Please submit your feature request here, so it is votable by the community. It's also easier for us to track.

[BUG | ISSUE] Expected Behaviour: Attempting to navigate to my recently registered and forwarded (301) domain should display my self-hosted Nextcloud instance. Using my public facing IP works fine.

[BUG | ISSUE] Actual Behaviour: Using cloud.domainname.com returns an error message stating: <IP address> redirected you too many times.

[BUG | ISSUE] Steps to reproduce:

(Optional) Debug token generated by pihole -d:

<token>= 9fs254j1uq

This template was created based on the work of udemy-dl.

EDIT: Fixed token -- "it was a 1 and not an L" Thanks you kindly, @WaLLy3K sir!

AzureMarker commented 7 years ago

Have you tried seeing what the redirects are?

WaLLy3K commented 7 years ago

To confirm, you're running a NextCloud instance on your Pi-hole? I believe this may cause issues due to how lighttpd redirects Javascript to a blank file, but I'm not 100% sure how that could result in a "redirected you too many times" type error.

For the record, your token is actually 9fs254j1uq - it was a 1 and not an L :smile:

harrypnyce commented 7 years ago

To confirm, I'm attempting to log on to test my self-hosted Nextcloud instance which runs on my ESXi host. The Pi-hole is doing DNS duty to provide network wide ad-blocking. I may be barking up the wrong tree entirely, but this is the message Pi-hole is presenting from my PC. Using my public facing IP address redirects properly to Nextcloud. Using my newly registered domain name (which has been added to Pi-hole's whitelist) is what's causing the redirect error. cloud.domainname.com fails, but XXX.XXX.XXX.XXX works fine, drops me right into Nextcloud.

dschaper commented 7 years ago

On the Pi-hole device does dig cloud.domainname.com resolve to the expected IP address?

dschaper commented 7 years ago

Also try a curl -IL could.domainname.com and that should show you what the redirects are.

harrypnyce commented 7 years ago

No, it is not resolving to the proper domain name (see below). I attempted to set it up with masking, could that be why i'm not seeing the expected IP? If i click "Previes" from within my Domain Manager, it does properly redirect to the expected Nextcloud instance on my ESXi host. I've copied and pasted the results from both suggestions made.

user@pihole:~$ dig cloud.domainname.com

; <<>> DiG 9.10.3-P4-Ubuntu <<>> cloud.domainname.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50566
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;cloud.domainname.com.             IN      A

;; ANSWER SECTION:
cloud.domainname.com.      420     IN      A       50.63.202.18

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Oct 08 16:30:16 EDT 2017
;; MSG SIZE  rcvd: 62
user@pihole:~$ curl -IL cloud.domainname.com
HTTP/1.1 302 Found
Connection: close
Pragma: no-cache
cache-control: no-cache
Location: /MfaYb/

HTTP/1.1 302 Found
Connection: close
Pragma: no-cache
cache-control: no-cache
Location: /

HTTP/1.1 200 OK
Cache-Control: max-age=900
Content-Length: 557
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sun, 08 Oct 2017 20:30:49 GMT
Age: 0
Connection: keep-alive
dschaper commented 7 years ago

Without knowing exactly how you have the domain configured and how you have forwarding set up to redirect the URLs it will be very difficult to diagnose. Pi-hole only handles domain name to IP configuration, we don't get involved with the HTTP stream at all. Adding in Godaddy and forwarding URL's via their system will add a level of complexity and configuration that we would not have access to be able to determine what the problem is and where the issue may be misconfigured. Have you made any changes to the lighttpd configurations on the Pi-hole? This is the only place that we could have any kind of influence on the redirects.

harrypnyce commented 7 years ago

DNS configuration -- https://imgur.com/1c4MzYk

cloud.domainname.com works fine from everywhere else in the world. It worked the very first evening i set things up, then something happened with my Pi-hole and it didn't react well to me typing/testing cloud.domainname.com, eventually returning what i'm faced with now "Redirected too many times. . ."

It's not a huge deal, more of an annoyance than anything else. I can simply use my IP address for testing, i wasn't sure if this was known behavior, expected, or otherwise. Thanks for the incredible product and stellar community support to match.

dschaper commented 7 years ago

Those are all http redirect rulesets which means that the domain resolves via DNS server on GoDaddy and then they handle the 301/302 redirects on their end of things. So that explains why the IP addresses don't match, the domain resolves to GoDaddy's server and they handle everything on their system.

I don't know GoDaddy's system as I don't use them for anything, but if any of the other members of the team do they may have some advice on how to proceed.

harrypnyce commented 7 years ago

As it's only a problem for me when attempting to access the domain name from my home network, which also doubles as my "self-hosted" Nextcloud (using cloud.domainname.com) instance i'm happy to continue working around it.

I truly appreciate the great community surrounding Pi-hole as well as the stupendous product. Behind Plex, it's quite possibly the most essential VM in my little budding, wannabe homelab. If i should Close this issue, please let me know. Or if there's any other information i can potentially provide to help others in the rare instance that might be faced with similar difficulties, i'd be happy to oblige. Thank you!

dschaper commented 7 years ago

We can close this, but if feel free to add or reopen if you come across anything else that might add to things. :+1:

harrypnyce commented 7 years ago

You guys are fantastic. Thank you, again.