Skip to content
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 rewrites don't work with subdomains of the same domain #4016

Closed
hauntedghost opened this issue Dec 25, 2021 · 6 comments
Closed

DNS rewrites don't work with subdomains of the same domain #4016

hauntedghost opened this issue Dec 25, 2021 · 6 comments
Assignees
Milestone

Comments

@hauntedghost
Copy link

I'm looking for a way to setup DNS redirects from amazon.com to smile.amazon.com.
I currently have a DNS Rewrite setup with the following settings and the redirect is not sending me to the correct URL.
dns_redirect

@agneevX
Copy link
Contributor

agneevX commented Dec 26, 2021

Because that's not how DNS works? It allows you to set a custom IP, not a host name.

@ZeroClover
Copy link

Because that's not what a DNS server should do.

To do what you want, you need to run an HTTP server, then install your own Root CA for all clients in your network to implement MitM, and then resolve amazon.com to your HTTP server. Finally configure the HTTP Server to send HTTP redirects (HTTP 301 / 302 / 307 / 308).

@hauntedghost
Copy link
Author

hauntedghost commented Dec 26, 2021 via email

@EugeneOne1
Copy link
Member

EugeneOne1 commented Dec 27, 2021

@hauntedghost, hello and thanks for the report. Looks like a bug actually. Consider using ||amazon.com^$dnsrewrite=NOERROR;CNAME;smile.amazon.com custom rule as a temporary workaround.

AGH doesn't support HTTP redirects, indeed, if the issue intends that.

@ainar-g ainar-g self-assigned this Dec 27, 2021
@ainar-g ainar-g added this to the v0.107.1 milestone Dec 27, 2021
@ainar-g
Copy link
Contributor

ainar-g commented Dec 27, 2021

The others are correct in their recommendations about the HTTP redirects, but the fact that a *.amazon.com → smile.amazon.com doesn't result in clients getting the correct CNAME of smile.amazon.com is definitely a bug. Will fix.

@ainar-g ainar-g changed the title DNS redirect amazon.com to smile.amazon.com DNS rewrites don't work with subdomains of the same domain Dec 27, 2021
adguard pushed a commit that referenced this issue Dec 27, 2021
Updates #4016.

Squashed commit of the following:

commit 83bb15c
Merge: 8190550 313555b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:36:44 2021 +0300

    Merge branch 'master' into 4016-rw-subdomain

commit 8190550
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:35:51 2021 +0300

    filtering: fix self reqs

commit b706f48
Merge: 29cf83d 661f4ec
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:13:08 2021 +0300

    Merge branch 'master' into 4016-rw-subdomain

commit 29cf83d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:07:08 2021 +0300

    all: fix docs

commit 9213fd8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 18:44:06 2021 +0300

    filtering: fix rw to subdomain
@ainar-g
Copy link
Contributor

ainar-g commented Dec 27, 2021

The issue with the incorrect CNAME rewrite to a subdomain should now be fixed on the edge channel. Once again, thanks for the report!

@ainar-g ainar-g closed this as completed Dec 27, 2021
adguard pushed a commit that referenced this issue Dec 29, 2021
Updates #4016.

Squashed commit of the following:

commit 83bb15c
Merge: 8190550 313555b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:36:44 2021 +0300

    Merge branch 'master' into 4016-rw-subdomain

commit 8190550
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:35:51 2021 +0300

    filtering: fix self reqs

commit b706f48
Merge: 29cf83d 661f4ec
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:13:08 2021 +0300

    Merge branch 'master' into 4016-rw-subdomain

commit 29cf83d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:07:08 2021 +0300

    all: fix docs

commit 9213fd8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 18:44:06 2021 +0300

    filtering: fix rw to subdomain
heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Updates AdguardTeam#4016.

Squashed commit of the following:

commit 83bb15c
Merge: 8190550 313555b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:36:44 2021 +0300

    Merge branch 'master' into 4016-rw-subdomain

commit 8190550
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:35:51 2021 +0300

    filtering: fix self reqs

commit b706f48
Merge: 29cf83d 661f4ec
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:13:08 2021 +0300

    Merge branch 'master' into 4016-rw-subdomain

commit 29cf83d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 19:07:08 2021 +0300

    all: fix docs

commit 9213fd8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 27 18:44:06 2021 +0300

    filtering: fix rw to subdomain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants