0

I have a problem with hosting a website on 2 different servers. My company has developed few pages with ASP.NET MVC for a client that their website is hosted on Linux. We are suppose to host those few pages with their dll, image, css and js files on our Windows host (it has 1 IP and many other websites hosted on it) but the address should be their domain... like www.ClientDomainLinux.com/MyMvcController/MyPage

I am a developer and I am not sure how should I set up IIS to achieve this... They have set up a proxy pointing to our hosting but none of the css, images or js files load and it doesnt function...

I need some help on how to setup up IIS so the links work properly,

Any sort of ideas are really appreciated.

Thanks

Amin
  • 3
  • 3

1 Answers1

2

Two solutions come to mind.

The first is a simple frame/iFrame on the Linux website of your client enclosing you ASP.NET www.yourwindowsserver.com/clients/clientXYZ/MyPage.

This is simple to set up, but for the more tech savvy visitors of your clients website it will be visible that they're redirected to a second server.

The second alternative would be to configure part of the of the Linux website as reverse proxy. This has the advantage that to the vistors it will appear seamless as they only make connection to www.ClientDomainLinux.com. The webserver on www.ClientDomainLinux.com will work as a HTTP proxy and take requests for /MyMvcController/MyPage, convert that incoming request to an outgoing request to www.yourwindowsserver.com/clients/clientXYZ/MyPage, receive the reply and will retransmit that reply to the websites visitor.

Linux webservers typically use an Apache webserver. A reverse proxy configuration either uses mod_proxy or alternatively mod_rewrite and this is typically something an administrator will need to configure.

# somewhere in the main apache configuration file
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

# either in the virtual host definition for www.ClientDomainLinux.com or possibly .htaccess
ProxyPass /MyMvcController/MyPage  http://www.yourwindowsserver.com/clients/clientXYZ/MyPage       
ProxyPassReverse /MyMvcController/MyPage http://www.yourwindowsserver.com/clients/clientXYZ/MyPage 

The alternative with a rewrite rule would look something like the following:

# somewhere in the main apache configuration file
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so

# either in the virtual host definition for www.ClientDomainLinux.com or possibly .htaccess
RewriteRule ^/MyMvcController/MyPage(.*) http://otherhost/otherpath$1 [P]

http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html http://httpd.apache.org/docs/2.4/mod/mod_proxy.html

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • Hi, Thanks for your reply. I already told the client about this and I will wait for them to reply. so I dont need to do any changes in the way I have set up IIS at my side? right now my MVC pages are running under a test domain on my windows server fine and it can be accessed like www.clinet.testdomain.com/MyMvcController/MyMvcView – Amin Sep 07 '13 at 05:32
  • right now they have set up their proxy as my page can be accessed by www.ClientDomainLinux.com/MyMvcController/MyMvcController/MyPage with MyMvcController repeated twice... – Amin Sep 08 '13 at 05:12