CNAMEs not working

For me CNAME redirects are not working. I tried to add index.hu -> and telex.hu as target, but site become unavailable:

@ubuntudev:~$ dig index.hu @localhost

; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> index.hu @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36629
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;index.hu.			IN	A

;; ANSWER SECTION:
index.hu.		2	IN	CNAME	telex.hu.

;; Query time: 0 msec
;; SERVER: ::1#53(::1)
;; WHEN: Tue Dec 01 18:49:13 CET 2020
;; MSG SIZE  rcvd: 59
@ubuntudev:~$ curl index.hu -v -L
* Rebuilt URL to: index.hu/
* Could not resolve host: index.hu
* Closing connection 0
curl: (6) Could not resolve host: index.hu

Any ideas?

Can you curl telex.hu correctly?

Yes. I ran dig again and now I see more data:

@ubuntudev:~$ dig index.hu

; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> index.hu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29716
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;index.hu.			IN	A

;; ANSWER SECTION:
index.hu.		2	IN	CNAME	telex.hu.
telex.hu.		265	IN	A	104.26.3.85
telex.hu.		265	IN	A	172.67.71.160
telex.hu.		265	IN	A	104.26.2.85

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Dec 01 18:59:01 CET 2020
;; MSG SIZE  rcvd: 107

@ubuntudev:~$ curl telex.hu -v
* Rebuilt URL to: telex.hu/
*   Trying 104.26.2.85...
* TCP_NODELAY set
* Connected to telex.hu (104.26.2.85) port 80 (#0)
> GET / HTTP/1.1
> Host: telex.hu
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently

When I curl in verbose mode I get 409 Conflict error:

@ubuntudev:~$ curl index.hu -v -L
* Rebuilt URL to: index.hu/
*   Trying 104.26.2.85...
* TCP_NODELAY set
* Connected to index.hu (104.26.2.85) port 80 (#0)
> GET / HTTP/1.1
> Host: index.hu
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 409 Conflict
< Date: Tue, 01 Dec 2020 18:00:22 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 16
< Connection: close
< X-Frame-Options: SAMEORIGIN
< Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Expires: Thu, 01 Jan 1970 00:00:01 GMT
< Set-Cookie: __cfduid=d92e1f639f641e36377699b876c0bd8e91606845622; expires=Thu, 31-Dec-20 18:00:22 GMT; path=/; domain=.index.hu; HttpOnly; SameSite=Lax
< cf-request-id: 06c10f7f9800001ce071a8f000000001
< Server: cloudflare
< CF-RAY: 5faeb5128e2e1ce0-BUD
<
* Closing connection 0
error code: 1001

Ah, this makes more sense.

doesn't cannot serve the requested (redirected) page on the requested IP address and, hence, responds with

You can see two different behaviors of curl

Once it tried to find the page telex.hu on said IP (which succeeded, you were redirected elsewhere), once it failed because the server at that IP does not know how to serve content for index.hu (which is likely hosted elsewhere). If you look closely, you see that the two curls are not identical.

edit Just adding that I get exactly the same, also from another DNS server. The server hosting telex.hu simply doesn't allow this.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.