Allow access to website (API) only from certain domain in IIS - iis

Given two websites:
a.com is a public website and can be accessed by anyone.
b.com is an API and can be accessed only from a.com domain.
How to restrict direct access to b.com in IIS?

In IIS you have feature called IP Address and domain restrictions. You can use same for what you want to achieve. There you can specify either specific IP or domain to allow/deny access.

Related

Possibility to host site content on one domain and access it via another

I have site1.domain1.com and site2.domain1.com
Is it possible to access to site2.domain1.com via domain2.com via cname or some other possibility?
So idea is to has content hosted at our server and allow user to access it via their own domain.
Is it possible somehow?
thanks
Regards,
Ilija
Both domain should point to same IP direction to get the same site. You need to configure your second domain domain2.com with same IP direction than site2.domain1.com

Create a CNAME from domain A going to domain B running IIS to a specific site not to the default site

I need to create a cname in a domain A pointing to a domain B.
Domain B is running under IIS where I have several sites, like:
site1.com,
site2.com ...
In my cname I'm pointing to site2.com, but it is going to the IIS default page.
What do I have to do?
I try to redirect, but it doesn't work as I want the name of the domain1 on URL bar.
Thanks
By default, IIS doesn't specify domain name for default web site which mean the default website will accept incoming request with any domain names.
When you need to point domain to specific website, please remember to create a binding host header and input its hostname
https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/sites/site/bindings/binding

Multiple websites on one IIS server

So if I have two domains i.e. domain1.example and domain2.example, both pointing to the exact same IP address (i.e. 192.0.2.1) on port 80.
How do I take users from domain1.example to one site, and users requesting from domain2.example to another site?
Additionally how do I set up subdomains? Someone requesting x.domain1.example should go to a third site.
When you configure the site in IIS you can assign the necessary host name in the bindings and the site will only respond to this.

Force use of Azure custom domain

Is it possible to prevent access to my Azure website from the Azure provided domain and force the use of the custom domain via a setting/configuration within Azure?
Right now I have a custom domain associated with my Azure Web App.
So, under domain names, there are 2 listed, my custom domain and the azure provided domain.
Example:
mywebapp.com
mywebapp.azurewebsites.net
I want traffic to only be allowed in via the custom domain. So, mywebapp.azurewebsites.net should either not be allowed or should redirect to mywebapp.com.
The easiest way is to change your web.config and add a URL Rewrite rule that will do a permanent redirect from the *.azurewebsites.net domain to your domain.
You can find an example on how they do that for domain.com to www.domain.com and you can apply the same logic. This article explains how to do that.

Delegation of sub-domain

I have a domain xyz.com whose registrar and web host are different. I have pointed the registrars name server entries to the web hosts ns01.host.com, etc.
On the web host, I have now created sub.xyz.com and want to delegate this domain to an external name server. Of course this is not possible straight off since the web host only allows IP Addresses against Custom A records.
What are my options to delegate sub.xyz.com to ns01.externalnameserver.com?
Instead of an A record on your registrar, you may use CNAME record to point the subdomain to an external address.

Resources