Monday, February 21, 2011

How to redirect request a.com/script.pl to server b.com, but avoid touching a.com server?

Hi! My site is hosted on a virtual hosting server - "Alpha". Also I host a web-service at Alpha. The service is a perl script and it works slow. There are a lot of clients that access the script. That makes the site work slow or even crash.

To solve the problem, I have transferred the service to a dedicated server - "Beta". Now there is a .htaccess redirect on "Alpha" that redirects service requests to "Beta"

Redirect /cgi-bin/weather/server/index.pl http://server.webhop.org/cgi-bin/weather/server/index.pl

However all the service requests go through "Alpha" and that seems to make the site work slow anyway.

Do you know how to redirect requests to alpha.com/cgi-bin/weather/server/index.pl to beta.com/cgi-bin/weather/server/index.pl avoiding requests to alpha.com server?

I know this would be easy to achieve with subdomains, but I cannot change the code on clients that all request to alpha.com/cgi-bin/weather/server/index.pl

My domain name is parked at godaddy.com.

From stackoverflow
  • Short answer: No.

    Only the first part of the URL (alpha.com) is used to determine where requests are sent to. The remainder of the URL is interpreted by the server that receives the request. So the minimal impact way of redirecting clients (without making changes on the client) appears to be exactly what you're doing - a redirect from alpha.com.

    Edit

    Alternate answer - get another server to act as a proxy for alpha.com, and forward the requests to the alpha and beta servers (and don't expose them to the net at all)

    Pavel : Thank you very much! I will be using the alternative way.

0 comments:

Post a Comment