lang2
lang2

Reputation: 11986

nginx DNS redirect: how does it work

I'm trying to do some DNS redirect: if user access h##p://subdomain.mydomain.com, he/she will be redirected to h##p://www.mydomain.com/some/url.

I think it can be done with a URL record in the DNS server. But like mentioned [here] it can be done with HTTP server configuration as well. And ... that confused me.

AFAIK, a request starts with a DNS resolve, which give us the IP address of the server. From there one, HTTP traffic are IP based. So how does nginx/apache know the server name?

Upvotes: 0

Views: 160

Answers (1)

Alexey Ten
Alexey Ten

Reputation: 14374

There is no DNS URL record. If you refer to DNSimple product, it's actually a combination of CNAME (or A) record and simple HTTP server.

HTTP clients (browsers) send server's name in a header as a part of HTTP request.

Upvotes: 1

Related Questions