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

Windows dns, cant make it work #41

Closed
stammail opened this issue Jun 27, 2020 · 3 comments
Closed

Windows dns, cant make it work #41

stammail opened this issue Jun 27, 2020 · 3 comments

Comments

@stammail
Copy link

stammail commented Jun 27, 2020

Hello, Im using windows dns for redirect and i can't make it work.
for example im trying to redirect http://www.cnn.local to https://www.walla.co.il

  1. created a zone name cnn.local
  2. created a cname record called "www" and put "www.walla.co.il.opts-https.redirect.center." in the fdqn host

when i query the dns i get the right info. C:\Users\Administrator>nslookup www.cnn.local
Server: UnKnown
Address: 212.x.x.x

Name: redirect.center
Address: 212.X.X.X (THIS IS MY DNS)
Aliases: www.cnn.local
www.walla.co.il.opts-https.redirect.center

but browsing using chrome and IE doesn't work
im getting
Something is wrong on your host: www.cnn.local

Error message:
queryCname ENOTFOUND www.cnn.local

redirect.center

tried with the dot (.) in fdqn and without it.
tied with the opts-https and without it.

noting helps.

what am i doing wrong?

@radfish
Copy link

radfish commented Jul 7, 2020

That won't work. The redirect server needs to lookup your source domain in the DNS system to know what to do. But, www.cnn.local is not a valid domain from the perspective of the server: hence, the error: CNAME not found for www.cnn.local.

The way it works is this, I think:

  1. user types source-domain.com into browser
  2. browser asks operating system to resolve DNS for source-domain.com
  3. operating system queries DNS system for source-domain.com to find CNAME record target-domain.com.redirect.center which further resolves to IP of the redirector server (redirect.center) IP 1.2.3.4
  4. browser sends GET request with Host header 'source-domain.com' to 1.2.3.4
  5. redirector server receives the GET request: at this point the server has no information about where to redirect!
  6. redirector server issues DNS lookup for 'source-domain.com' and looks for CNAME record (which should be there, since step 3 relies on it) whose value should be 'target-domain.com.redirect.center'
  7. redirector server parses the value of the CNAME record 'target-domain.com.redirect.center' to extract 'target-domain.com' and options
  8. redirector server constructs a response to the GET request with status code 301 (moved) and Location header set to 'http://target-domain.com/'

This is also why just accessing 'target-domain.com.redirect.center' from the browser will not work, because in Step 4, the Host header will be 'x.redirect.center' and the DNS lookup in 6 will just find 'CNAME redirect.center', and target-domain.com won't ever be used.

Other redirect services (https://redirect.name) lookup the target information from other DNS records like TXT, but the principle is the same: this information about the target redirect can only come from DNS because it is not contained within the GET request.

PS. @udleinati might be useful to post this basic info about how it works in the title page, because this is not obvious, to save people from figuring it out every time.

@stammail
Copy link
Author

stammail commented Sep 4, 2020

That won't work. The redirect server needs to lookup your source domain in the DNS system to know what to do. But, www.cnn.local is not a valid domain from the perspective of the server: hence, the error: CNAME not found for www.cnn.local.

The way it works is this, I think:

  1. user types source-domain.com into browser
  2. browser asks operating system to resolve DNS for source-domain.com
  3. operating system queries DNS system for source-domain.com to find CNAME record target-domain.com.redirect.center which further resolves to IP of the redirector server (redirect.center) IP 1.2.3.4
  4. browser sends GET request with Host header 'source-domain.com' to 1.2.3.4
  5. redirector server receives the GET request: at this point the server has no information about where to redirect!
  6. redirector server issues DNS lookup for 'source-domain.com' and looks for CNAME record (which should be there, since step 3 relies on it) whose value should be 'target-domain.com.redirect.center'
  7. redirector server parses the value of the CNAME record 'target-domain.com.redirect.center' to extract 'target-domain.com' and options
  8. redirector server constructs a response to the GET request with status code 301 (moved) and Location header set to 'http://target-domain.com/'

This is also why just accessing 'target-domain.com.redirect.center' from the browser will not work, because in Step 4, the Host header will be 'x.redirect.center' and the DNS lookup in 6 will just find 'CNAME redirect.center', and target-domain.com won't ever be used.

Other redirect services (https://redirect.name) lookup the target information from other DNS records like TXT, but the principle is the same: this information about the target redirect can only come from DNS because it is not contained within the GET request.

PS. @udleinati might be useful to post this basic info about how it works in the title page, because this is not obvious, to save people from figuring it out every time.

Hello, @radfish
thank you for the email.

i still cant make it work.
any chance of assisting me. willing to pay.
please conatct me yaron.e(at)gmx.com

@udleinati
Copy link
Owner

udleinati commented Jun 20, 2022

@stammail were you able to make it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants