IIS redirect users to another server - http

I have two IIS instances running on different servers with identical code base. The application that runs on these servers reads from a same SQL database. I was wondering if sending users from one server to another possible?

create iis rewrite rule to then rewrite to specific server within a server farm
for your instance you will use "rewrite" instead of "rewrite to server farm"
check this link to see how to setup rewrite action (ARR as a Forward Proxy)
http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/creating-a-forward-proxy-using-application-request-routing

Related

IIS to handle api and website on same port

I have an API built with asp.net and its hosted using OWIN.hosting.WebApp as a Windows Service at https://example.com/api/v1/myEndpoint. Its bound to port 443 through netsh. When i start the OWIN application, its done like:
Dim Address As String = "https://*:443/
WebApp.Start(Of Application)(Address)
I also have my website hosted in IIS using SSL and bound to port 443 - https://example.com/web
They both start up and run without error. But it seems like IIS is blocking requests to the https://example.com/api/v1/myEndpoint. Postman cannot reach the API while IIS is running. If i stop IIS and try the exact same postman request the API returns back data like it should. As soon as i start IIS back up, the API will no longer respond.
Is there a rewrite rule i can add to forward the API requests the API service?
In my opinion, you could not host the asp.net web API windows service in iis.
a single IIS server can host multiple websites, but in order IIS to distribute HTTP requests correctly, each website has to be identified with some unique value. In case of an IIS website, it consists of three attributes that make up a unique combination for each website. These are:
a TCP port number
an IP address
a host header
The information about the hosted websites is stored in the ServerBindings attribute of the IIS Metabase in the following format: IP:Port:Hostname. Thus, if you want to host multiple websites on the same port, you will have to use a unique Host header or Ip address.
You could refer below link for more detail:
http://woshub.com/run-multiple-websites-on-the-same-port-and-ip-address-on-iis/

Nginx Reverse Proxy With Alternating Live Backend Services

I have different versions of a backend service, and would like nginx to be like a "traffic cop", sending users ONLY to the currently online live backend service. Is there a simple way to do this without changing the nginx config each time I want to redirect users to a different backend service?
In this example, I want to shut down the live backend service and direct users to the test backend service. Then, vice-versa. I'm calling it a logical "traffic cop" which knows which backend service to direct users to.
I don't think adding all backend services to the proxy_pass using upstream load balancing will work. I think load balancing would not give me what I'm looking for.
I also do not want user root to update the /etc/hosts file on the machine, because of security and collision concerns with multiple programs editing /etc/hosts simultaneously.
I'm thinking of doing proxy_pass http://live-backend.localhost in nginx and using a local DNS server to manage the internal IP for live-backend-localhost which I can change (re-point to another backend IP) at any time. However, would nginx actually query the DNS server on every request, or does it resolve once then cache the IP forever?
Am I over-thinking this? Is there an easy way to do this within nginx?
You can use the backup parameter to the server directive so that the test server will only be used when the live one is down.
NGINX queries DNS on startup and caches it, so you'd still have to reload it to update.

How to identify an application run in server using url

How can we identify an application running on a server using a url? What will be included in the url to identify the application? Is it the IP address of the server?
If you are attempting to identify what applications a server is running (or serving) based on just the URL, it isn't that simple.
A single server could be running zero, one, or many applications. Additionally, not all applications running on a server will be accessible via HTTP. Therefore, not all applications can be identified via URL.
URLs tend to represent the file/routing structure on a web server. Your best guess at what application is running on a server, solely based on URL, would be to reference the fully qualified domain name (FQDN). The FQDN may hint about what the web server you are utilizing may be intended for.

URL Rewrite to different sub domain on different server - IIS 7

I have the following setup:
Specific DNS per server 4 servers in total:
app1.domain.com
app2.domain.com
app3.domain.com
app4.domain.com
Shared DNS that is hosted on all servers
www.domain.com
What I want is to rewrite specific URLS to a specific server. For example,
www.domain.com/account may rewrite to app1.domain.com/account Is this possible if so how?
Keep in mind that a given account can only live on one server at a time.

Dynamic (database) IP Blocking with SQL on IIS 7.5

I am using IIS7.5 URL rewrite module to look up redirect and rewrites in the SQL database attached to my website - and am now trying to use the same system to look up a list of IP address I wish to block (return 403).
I have a table of IPs (in SQL server) which is continually updated (outside of the remit of this question) and I want IIS to pass the IP address of the current request to a stored procedure which will then return a Pass/Fail on whether to allow the request to continue or return a HTTP 403.
I don't seem to be able to work out how to configure this in IIS.
Many thanks

Resources