-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNS entry broken with endless redirect loop #1233
Comments
You may want |
@Luzifer wow, that sucks! any ideas where this could be? |
@jbenet i can take a look at this in the morning |
There are no repositories in DockerHub/ipfs. (Should have added I meant DockerHub |
Hmm just discovered the new # dig any swagger.luzifer.io
; <<>> DiG 9.8.3-P1 <<>> any swagger.luzifer.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46832
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;swagger.luzifer.io. IN ANY
;; ANSWER SECTION:
swagger.luzifer.io. 571 IN TXT "dnslink=/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/"
swagger.luzifer.io. 571 IN A 188.40.126.69
;; Query time: 2 msec
;; SERVER: 10.228.0.254#53(10.228.0.254)
;; WHEN: Sat May 16 11:51:09 2015
;; MSG SIZE rcvd: 126
# curl -i -s swagger.luzifer.io
HTTP/1.1 301 Moved Permanently
Content-Length: 93
Content-Type: text/html; charset=utf-8
Date: Sat, 16 May 2015 09:52:39 GMT
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
<a href="/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/">Moved Permanently</a>.
# curl -IL -s swagger.luzifer.io
HTTP/1.1 301 Moved Permanently
Content-Type: text/plain; charset=utf-8
Date: Sat, 16 May 2015 09:51:23 GMT
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
HTTP/1.1 301 Moved Permanently
Content-Type: text/plain; charset=utf-8
Date: Sat, 16 May 2015 09:51:23 GMT
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
HTTP/1.1 301 Moved Permanently
Content-Type: text/plain; charset=utf-8
Date: Sat, 16 May 2015 09:51:23 GMT
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
HTTP/1.1 301 Moved Permanently
Content-Type: text/plain; charset=utf-8
Date: Sat, 16 May 2015 09:51:23 GMT
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ |
Specifying a file in that folder made it worse: # dig any swagger.luzifer.io
; <<>> DiG 9.8.3-P1 <<>> any swagger.luzifer.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31388
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;swagger.luzifer.io. IN ANY
;; ANSWER SECTION:
swagger.luzifer.io. 2 IN TXT "dnslink=/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/index.html"
swagger.luzifer.io. 542 IN A 188.40.126.69
;; Query time: 2 msec
;; SERVER: 10.228.0.254#53(10.228.0.254)
;; WHEN: Sat May 16 12:01:37 2015
;; MSG SIZE rcvd: 136
# curl -i -s swagger.luzifer.io
HTTP/1.1 301 Moved Permanently
Content-Length: 104
Content-Type: text/html; charset=utf-8
Date: Sat, 16 May 2015 10:01:40 GMT
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/index.html/
<a href="/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/index.html/">Moved Permanently</a>. |
Also specifying only the hash did not work: # dig any swagger.luzifer.io
; <<>> DiG 9.8.3-P1 <<>> any swagger.luzifer.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12464
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;swagger.luzifer.io. IN ANY
;; ANSWER SECTION:
swagger.luzifer.io. 59 IN TXT "dnslink=QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA"
swagger.luzifer.io. 599 IN A 188.40.126.69
;; Query time: 265 msec
;; SERVER: 10.228.0.254#53(10.228.0.254)
;; WHEN: Sat May 16 12:02:52 2015
;; MSG SIZE rcvd: 119
# curl -i -s swagger.luzifer.io
HTTP/1.1 301 Moved Permanently
Content-Length: 93
Content-Type: text/html; charset=utf-8
Date: Sat, 16 May 2015 10:02:54 GMT
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
<a href="/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/">Moved Permanently</a>. |
Reproducible with latest source code version, so most likely not a bug in the container: # curl -i -H 'Host: swagger.luzifer.io' http://localhost:8080/
HTTP/1.1 301 Moved Permanently
Location: /ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 10:09:46 GMT
Content-Length: 93
Content-Type: text/html; charset=utf-8
<a href="/ipfs/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/">Moved Permanently</a>. |
DNS resolver works well. (Introduced one more log line to test) # ./ipfs daemon --debug 2>&1 | grep namesys
12:21:32.829 INFO namesys: DNSResolver resolving %vswagger.luzifer.io namesys.go:40
12:21:32.879 DEBUG namesys: Got path from DNS: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ namesys.go:40 |
Okay looks like I got the cascading # curl -i -H 'Host: swagger.luzifer.io' http://localhost:8080/
HTTP/1.1 301 Moved Permanently
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 10:28:05 GMT
Content-Length: 88
Content-Type: text/html; charset=utf-8
<a href="/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/">Moved Permanently</a>. diff --git a/core/corehttp/ipns_hostname.go b/core/corehttp/ipns_hostname.go
index 7361001..a6e8e91 100644
--- a/core/corehttp/ipns_hostname.go
+++ b/core/corehttp/ipns_hostname.go
@@ -20,7 +20,7 @@ func IPNSHostnameOption() ServeOption {
host := strings.SplitN(r.Host, ":", 2)[0]
if p, err := n.Namesys.Resolve(ctx, host); err == nil {
- r.URL.Path = "/ipfs/" + p.String() + r.URL.Path
+ r.URL.Path = p.String() + r.URL.Path
}
childMux.ServeHTTP(w, r)
}) |
Woot. After that change made above it works as soon as I remove the trailing slash from the # dig any swagger.luzifer.io
; <<>> DiG 9.8.3-P1 <<>> any swagger.luzifer.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31381
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;swagger.luzifer.io. IN ANY
;; ANSWER SECTION:
swagger.luzifer.io. 37 IN TXT "dnslink=/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA"
swagger.luzifer.io. 577 IN A 188.40.126.69
;; Query time: 2 msec
;; SERVER: 10.228.0.254#53(10.228.0.254)
;; WHEN: Sat May 16 12:39:52 2015
;; MSG SIZE rcvd: 125
# curl -s -i -H 'Host: swagger.luzifer.io' http://localhost:8080/ | head -n20
HTTP/1.1 200 OK
Cache-Control: public, max-age=29030400
Etag: QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA
Suborigin: QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA
X-Ipfs-Path: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 10:39:53 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
<!DOCTYPE html>
<html>
<head>
<title>Swagger UI</title> |
(Updated issue with TODO) |
Specifying a file does work too but not the path with trailing slash: # dig any swagger.luzifer.io
; <<>> DiG 9.8.3-P1 <<>> any swagger.luzifer.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41587
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;swagger.luzifer.io. IN ANY
;; ANSWER SECTION:
swagger.luzifer.io. 59 IN TXT "dnslink=/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/index.html"
swagger.luzifer.io. 599 IN A 188.40.126.69
;; Query time: 340 msec
;; SERVER: 10.228.0.254#53(10.228.0.254)
;; WHEN: Sat May 16 13:03:40 2015
;; MSG SIZE rcvd: 136
# curl -s -i -H 'Host: swagger.luzifer.io' http://localhost:8080/ | head -n20
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: public, max-age=29030400
Content-Length: 3921
Content-Type: text/html; charset=utf-8
Etag: index.html
Last-Modified: Thu, 01 Jan 1970 00:00:01 GMT
Suborigin: QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA
X-Ipfs-Path: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/index.html/
Date: Sat, 16 May 2015 11:03:43 GMT
<!DOCTYPE html>
<html>
<head>
<title>Swagger UI</title> |
Example of remaining redirect cascading: # dig any swagger.luzifer.io
; <<>> DiG 9.8.3-P1 <<>> any swagger.luzifer.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62127
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;swagger.luzifer.io. IN ANY
;; ANSWER SECTION:
swagger.luzifer.io. 59 IN TXT "dnslink=/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/"
swagger.luzifer.io. 599 IN A 188.40.126.69
;; Query time: 95 msec
;; SERVER: 10.228.0.254#53(10.228.0.254)
;; WHEN: Sat May 16 13:53:43 2015
;; MSG SIZE rcvd: 126
# curl -s -iL -H 'Host: swagger.luzifer.io' http://localhost:8080/
HTTP/1.1 301 Moved Permanently
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 11:53:57 GMT
Content-Length: 88
Content-Type: text/html; charset=utf-8
HTTP/1.1 301 Moved Permanently
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 11:53:57 GMT
Content-Length: 140
Content-Type: text/html; charset=utf-8
HTTP/1.1 301 Moved Permanently
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 11:53:57 GMT
Content-Length: 192
Content-Type: text/html; charset=utf-8
HTTP/1.1 301 Moved Permanently
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 11:53:57 GMT
Content-Length: 244
Content-Type: text/html; charset=utf-8
HTTP/1.1 301 Moved Permanently
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 11:53:57 GMT
Content-Length: 296
Content-Type: text/html; charset=utf-8
HTTP/1.1 301 Moved Permanently
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 11:53:57 GMT
Content-Length: 348
Content-Type: text/html; charset=utf-8 |
Gotcha! # curl -si ipfs.hub.luzifer.io/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA//
HTTP/1.1 301 Moved Permanently
Content-Length: 88
Content-Type: text/html; charset=utf-8
Date: Sat, 16 May 2015 13:04:59 GMT
Location: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
<a href="/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/">Moved Permanently</a>. Fix for both redirect issues: diff --git a/core/corehttp/ipns_hostname.go b/core/corehttp/ipns_hostname.go
index 7361001..19daefd 100644
--- a/core/corehttp/ipns_hostname.go
+++ b/core/corehttp/ipns_hostname.go
@@ -20,7 +20,7 @@ func IPNSHostnameOption() ServeOption {
host := strings.SplitN(r.Host, ":", 2)[0]
if p, err := n.Namesys.Resolve(ctx, host); err == nil {
- r.URL.Path = "/ipfs/" + p.String() + r.URL.Path
+ r.URL.Path = strings.TrimRight(p.String(), "/") + r.URL.Path
}
childMux.ServeHTTP(w, r)
}) Appending the |
# dig any swagger.luzifer.io
; <<>> DiG 9.8.3-P1 <<>> any swagger.luzifer.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47108
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;swagger.luzifer.io. IN ANY
;; ANSWER SECTION:
swagger.luzifer.io. 59 IN TXT "dnslink=/ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/"
swagger.luzifer.io. 599 IN A 188.40.126.69
;; Query time: 62 msec
;; SERVER: 10.228.0.254#53(10.228.0.254)
;; WHEN: Sat May 16 15:20:33 2015
;; MSG SIZE rcvd: 126
# curl -s -iL -H 'Host: swagger.luzifer.io' http://localhost:8080/ | head -n20
HTTP/1.1 200 OK
Cache-Control: public, max-age=29030400
Etag: QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA
Suborigin: QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA
X-Ipfs-Path: /ipfs/QmczrnBpAgnhCo87rtZ8VbLfGU5v8g7cKr7Ef2fKRvYniA/
Date: Sat, 16 May 2015 13:20:37 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
<!DOCTYPE html>
<html>
<head>
<title>Swagger UI</title> |
As an IPFS user wanting to host a static website in IPFS I'd set an
TXT
and anA
record to my domain to point to an IPFS endpoint and having an hash containing the website itself like explained in #760.Expected behavior
When I open the website I expect to get it served.
Actual behavior
I'm trapped in an endless redirect loop
Version
Latest Docker-Image from
jbenet/go-ipfs
Steps to reproduce
TODO
/ipfs/ipfs/...
foodnslink
with trailing slash breaks and causes a cascading redirectdnslink
has?The text was updated successfully, but these errors were encountered: