IIS 7 IP address forwarding - iis

I want to move some websites from server 1 to server 2.
My clients have A records pointing to the IP address of server 1. Without updating their DNS records, how can I automatically forward request for those domains from server 1 to server 2?
Thanks
Graham

This image is from an article regarding Exchange, but the IIS settings are relevant.
You can redirect at the HTTP level by specifying a URL redirect in IIS's HTTP Redirect settings:-
However, for this approach to work you will need a new domain for your sites. e.g. if the A record resolves www.example.com to Server 1 you will need to redirect to another URL (e.g. www.example.edu) that already resolves to Server 2.
Another option is to setup a reverse proxy using IIS on Server 1:
Today there was a question in the IIS.net Forums asking how to expose two different Internet sites from another site making them look like if they were subdirectories in the main site.
So for example the goal was to have a site: www.site.com expose a www.site.com/company1 and a www.site.com/company2 and have the content from www.company1.com served for the first one and www.company2.com served in the second one
So slightly different requirements (the article only wants a subdirectory rather than the whole site), but the same concept will apply.

Related

Windows server 2012, cname record returns http error 404, Is my iis blocking cname records?

I'm testing a cname record to a domain on my windows server 2012 r2 for future purposes.
I have this website => http://hiligolan.co.il/ which is already running.
This is the binding setup
Now I'm trying to set a different domain to the one I mentioned above using a cname record
When I'm surfing to http://rideme.co.il/ it returns http not found (as you can see)
Checking the ping shows no problem
So I assume that maybe the problem is at the server,
Could it be that something in the iis configuration blocking it?
note: I'm not looking for 301/2 redirect, what am I looking for is that anyone who will surf http://rideme.co.il/ will actually see http://hiligolan.co.il/ website but under rideme.co.il domain.
note 2: I'm not looking to add every other domain on my iis host binding (assuming I have thousands domain), I just want it to be "open" to all, allow every domain referring cname to => http://hiligolan.co.il/ to display it.
Thanks in advance.
You explicit ask IIS to only forward HTTP requests whose Host header contain hiligolan.co.il with that site binding.
Therefore, any request with Host header of rideme.co.il is not forwarded and 404 makes perfect sense.
The fix is also easy, to add a second site binding for the new domain.
Reference
https://docs.jexusmanager.com/tutorials/binding-diagnostics.html#background

Redirect a request to a colud server from a godady server with .htaccess

Hi everyone need your support with the following problem. Please do apologies if I confuse you in anyways with my explanation.
I have a add-on domain (example.com) pointed to a Godaddy Linux server, domain is also in the Godaddy same account.
The web application for "example.com" is a Laravel 5.6 based one, and the web app has 'Get' type search form which needs to be forwarded to another Windows IIS server's port with all the query strings where another web app is hosted. the action of the from will be similar to below.
Request => http://sub1.example.com/route/method?var=val1&var2=val2&var3=val3
From this point on-wards the application has to continue work from the IIS server with the subdomain, which mean I am not expecting any replies from this IIS server to the Linux server.
Its been advised to use the subdomain to mask the forwarding to the IIS server, so I did like above with sub1 sub-domain. This subdomain has to be forwarded to a server's port as I mentioned above, something similar to below.
http://sub1.example.com => http://xxx.xxx.xxx.xx:9596
I did tried with the Godaddy's default subdomain forwarding with masking, but the query strings are not being forwarded and shows "Destination Unknown" error.
In a online forum its been advised not to go with Godaddy's forwarding instead go with .htaccess to have more control.
Therefore any possible solutions or your support with the redirection with .htaccess from web application to the external web server's specific port along with the query strings would be a life saver.
Thank you in advance.
As per the GoDaddy support, the domain forwarding to a IP's port is not possible with the Shared hosting.
The support suggested to go-ahead with the VPS and configure.
Please do comment, if this is wrong statement!

IIS 8.5 Proxy rewrite failing

I'm new to setting up proxy servers. On our actual web server. We have our website and within IIS this sits under wwwroot. I then have 2 other directories outside wwwroot, one with images and one with documents. Before I introduced the proxy the main site had virtual directories to the other 2 areas and all was ok. Moving to a more complex setup I have removed the virtual directories as these need to be re-directed via the proxy. So, basically any address for an image or document from the main site needs to redirect via the proxy to either the images or document area.
I've created 2 more websites in IIS one for documents and one for images and I've set the IP for these to be the same as the main site including the same port. Now moving to the proxy. I've created server farms for all the sites calling them the same name here (dns) as the names on the webserver. This has created default ARR URL Rewrite rules for each server in the farm. I wrote an inbound rule at the Proxy Server level that should redirect the images and using the in-built test showed that I'd put the test together correctly. However, placing it here or on an outbound rule made no difference.
I installed the IIS Trace facility on the proxy and noticed that the test wasn't being hit after looking at the trace logs. I moved my rule to the url rewrite inbound against the default site as opposed to the server. Now in the trace on step 4 I can correctly see that the old url has changed to my newURL and the NewUrl is my expected url, Great!. however, by the time the Trace reaches step 40, it is taking my new correct url as input and removing the domain name for the new url at this step, thus effectively putting the address back to the original. On the inbound rule that made the initial change I have Stop processing of subsequent rules checked.
These are the steps I have done for images and they are finally coming through.
on the web server all my sites have the same IP and port number, only the hostnames are different.
on my local client machine for now in my hosts file I point the main site to the ip of the proxy, but the other sites that I want to redirect to I point their ip to the actual webserver.
in the server the server farm has just 1 ARR entry that is the main site. Leave this as the default, but uncheck the stop processing flag. Create a new inbound URL ReWrite rule for the first redirect. Make the action type a Redirect (not a rewrite this is important.)
On the proxy under the default website, create binding entries for each hostname setting ports the same with ip address set to * then additionally create a blank hostname of the same.

How to run a website in Azure using same URL?

Our company has two sites
www.mysite.com -- Wordpress site
www.mysite.com/portal -- asp.net mvc site
We want to move the wordpress site (www.mysite.com) to Azure and the other site stays local. We need to url stay the same. How can we achieve this?
Since you state that you need the URL to stay the same, this can be achieved through a reverse proxy. You would set up a web server (typically nginx or IIS) answering on www.mysite.com.
This web server would have reverse proxy rules to forward requests for /portal to your on-premises server (in a given, non-public IP and port) and all other requests to another web server running WordPress (on the same server/cluster that runs the reverse proxy, or a separate one), also with a given IP and port.
All user requests, then, would reach the reverse proxy, that would serve them from cache if possible, or forward them to the internal web servers, and send the response back to the user, transparently. Notice that this is an internal operation, not a redirect response.
Although this setup is more complex than the simpler solution of using different subdomains (www.mysite.com for website and portal.mysite.com for application), it comes with certain advantages that are described in the referenced Wikipedia article, such as security and acceleration.
Alternatively you could create separate subdomains as described above, and use a redirect rule to redirect requests for www.mysite.com/portal/x to portal.mysite.com/x. In this case, the user would see the updated URL in their browser, but the old ones would still work.

How to redirect different sub domain requests to different servers

Under my domain, one of the subdomain must be directed to one server that hosts the relevant applications, and the rest must be directed to another server that hosts the relavant applications.
So, any requests to the url appa.example.com\* must be directed to one server, and any requests to the url appb.example.com\* must be directed to another server.
The issue now is how to configure the Apache configuration on both servers-- maybe using configuration like ProxyPass or ProxyPassReverse so that they all the incoming requests can be directed correctly at the correct server?
Edit to make the question clearer.
The place to link an url to an IP (server) is the DNS.
For example if server A is at 1.2.3.4 and server B at 5.6.7.8 you link appa.example.com to 1.2.3.4 and appb.example.com to 5.6.7.8.
But if both servers are behind a firewall (with a single external IP address) you have to perform some tricks. (And you are probably looking for these tricks).
Have a look at An Introduction to Redirecting URLs on an Apache Server.
I've done the same thing for my workplace (a University). Our primary website it hosted elsewhere but part of the site (student registration system) is hosted onsite.
What I did was to create a Authoritative (A) DNS Record (reg.domain.com) and made it point to the IP of our onsite server. And that did the trick!!!
Here's a screenshot of the same from my domain CP (domain and IP masked for obvious reasons)...
alt text http://img443.imageshack.us/img443/5069/stiuaregrecord.jpg
It's essentially the same as what you're trying to do. Give it a shot and see :)
In the DNS records/manager for the parent domain of the intended subdomain:
point the subdomain name at the to-be host servers IP address, then ...
... Then ...
In the host server DNS and or server-software config: direct the subdomain to the website app. You can achieve this by one of: -
manually edit the DNS records,
park the subdomain and point it at the website document root folder, or
add the domain and subdomain (domain will never be used since its not pointed at applicable server). Point them both at the document root for your now subdomained (if there is such a word) website app

Resources