Forum Moderators: phranque

Message Too Old, No Replies

ASP - Host variable redirect not working

         

Marshall

2:49 am on Mar 21, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If I put this on my website it works.
IF Request.ServerVariables("http_host")="www.mydomain.com" THEN
Response.Redirect "towherever"
END IF

However, on a site that is channeled through CloudFlare, this script does not work.
IF Request.ServerVariables("http_host")="www.baddomain.com" THEN
Response.Redirect "towherever"
END IF

The Response.Redirect as a stand alone works on the CloudFlare site, just not when your add the Request.ServerVariables("http_host")

Any thoughts or suggestions will be welcomed.

Kendo

3:27 am on Mar 21, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Isn't Cloudfare a caching service? if so then it will be the assembled page that is cached and served from Cloudfare servers. That is, Classic ASP may be actively run on your site, but it only applies to pages dynamically delivered by your server.

To action anything on pages served via cache you may need to resort to JavsScript.

Marshall

10:55 am on Mar 21, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



As I said, if I just put in
<%Response.Redirect "towherever"%>
it works fine, as does
<%Response.Write(Request.ServerVariables("HTTP_HOST"))%>
So I know ASP is running.