host header in iis7 - iis-7

i have following doubts while creating new sites in iis7
what should be value of host header in site binding. should it match with domain name ?
should website name and host header be same?

If your websites are www.example.com and blogs.example.com, your host headers should be www.example.com and blogs.example.com.
If you want any traffic to a name that resolves to an IP address on your server to go to a specific site, then don't put a host header on that site. (E.g. have a host header for blogs.example.com but not for www.example.com.)

Related

nginx reverse proxy upstream server using domain name (ex. www.test.com)

I have a website hosted somewhere in some server. lets say the domain name is https://www.test.com
Now, I am working on setting up the reverse proxy for this website using the upstream server for this domain name and it is not working.
I don't want to try it with the IP Address.
I want to try it upstream server with the domain name.
Any help is much appreciated.

How can different subdomains point to the same IP and reach different webpages?

I have a firebase project with 2 web applications:
name: url
PC pc-my-app.web.app
Mobile m-my-app.web.app
firebase gives me the IP X.X.X.X for both applications.
I have a domain, example.com with the following records:
A example.com X.X.X.X
A m.example.com X.X.X.X
I thought that having these records pointing to the same IP would mean I see the same webpage, but that is clearly not the case.
Since ports are (apparently) never specified, how can the server on X.X.X.X tell which application I am trying to connect to?
My guess is that the server on X.X.X.X also recieves the original URL as a parameter somehow...
Firebase Hosting (and most other hosting providers) check the Host header in the incoming request to determine what content to serve. And this Host header value allows a single server to map different requests to the correct web site content (often referred to as a "virtual host").
Also see:
The MDN documentation for Host header
What is HTTP "Host" header?

Can I use IIS host-header binding to avoid having to use port number in url

Is it possible to configure host header binding of site in IIS to a particular port so that users do not have to specify the port number in a url?
This is for an intranet site. We have several sites hosted on the one server each with their own host name with DNS entries which point to the same machine name.
I have tried specifying host-header name (site-specific hostname), unique port number and "*" for IP address, but to access the site I still have to specify the port number in the browser.
I was hoping that binding the site to the unique host name would be enough to resolve the site without having to specify the port number in the url.
Thanks.
What you need is a redirect.
What I would do, if there is no querystring is have a binding for the same domain in one of the standard ports 80 or 443 if you use SSL. Then use IIS Redirect to redirect all requests to the URL with the custom port.
Another way would be to use URL Rewrite to do the redirects so you can keep the querystring. For example 10 URL Rewriting tips and tricks

route 53 CNAME with Nginx

I have a domain and its DNS entries are managing using AWS Route53.
I have 30 servers on a datacenter which only have private IPs, and the sites hosted on these servers are loading using a nginx proxy server which have public IP.
For this, I have created an A record (say *.abc.com A IPofproxy), then I added some redirection rules on proxy server to load the corresponding sites.
redirection rule on proxy server are as follows :
1.abc.com redirects to 1.1.1.1
2.abc.com redirects to 2.2.2.2
3.abc.com redirects to 3.3.3.3 , etc.
But now am facing an issue with the CNAMEs,
The issue is,
I created some CNAME records like :
abc.abc.com CNAME 1.abc.com
def.abc.com CNAME 2.abc.com
fgh.abc.com CNAME 3.abc.com , etc
Then I tried to access all of the above domains (abc.abc.com , def.abc.com, etc), but all the sites are pointing to only one server which is the first one on redirection rules.
I am new to nginx, it would be great if anyone help me to fix this.
If I'm understanding your configuration correctly, the issue you're experiencing is not specifically related to either Route 53 or Nginx.
Instead, it's related to how web browsers interact with DNS entries. You'd have this issue with any reverse proxy server.
You have to configure each CNAME entry in your proxy, individually, because the browser doesn't care about the CNAME entry -- the Host: header sent with each request is the hostname the browser started with, not the hostname the browser ended up with after any CNAMEs were traversed.
a.example.com IN A 203.0.113.1
b.example.com IN CNAME a.example.com.
A request for b.example.com will be routed by the proxy according to its rules for b.example.com and not by its rules for a.example.com, because the CNAME does not change the browser's Host: header, which is what the proxy is almost certainly using for its routing decision.
If you want requests for b.example.com, it must be configured in the proxy, and not only in the DNS.

Why is a host header needed when requesting a page via HTTP?

If a browser is connected to a server and is requesting a web page, why would it need the host header when it has already made the connection?
Because the server might be serving content for multiple, different host names.

Resources