supertramp4
asked on
Simple iis URL rewrite from internal hostnameA to hostnameB
I have a simple requirement to redirect any request that is in our local internal intranet , from hostA to HostB on a custom port number
ie from
http://PCa/xx/<anythinghere>
to
http://PCb:8282/<anythinghere>
On PCa I have iis 7.5, and have installed the URL rewrite module, I can not get this URL Rewrite to work
Currently I have an IIS Site on PCa called "xx"
Its a virgin site, with nothing in it other than the web.config file
HTTP redirect is turned off
Under URL Redirect,
Match URL : Match Pattern, Regular expression "^.*"
Conditions : none
Action : rewrite, rewrite URL "http://PCb:8282
Any thoughts to get this up and running ?
NOTE the <anythinghere> could literally be any content, so it needs to be appended to the new "http://PCb:8282/"
TIA
ie from
http://PCa/xx/<anythinghere>
to
http://PCb:8282/<anythinghere>
On PCa I have iis 7.5, and have installed the URL rewrite module, I can not get this URL Rewrite to work
Currently I have an IIS Site on PCa called "xx"
Its a virgin site, with nothing in it other than the web.config file
HTTP redirect is turned off
Under URL Redirect,
Match URL : Match Pattern, Regular expression "^.*"
Conditions : none
Action : rewrite, rewrite URL "http://PCb:8282
Any thoughts to get this up and running ?
NOTE the <anythinghere> could literally be any content, so it needs to be appended to the new "http://PCb:8282/"
TIA
ASKER
Hi Dan,
That Partly works.
If I goto http://PCa/xx, then that works correctly, re-directs to http://PCb:8282/ and displays the correct webpage on the new host. - Great
If however I goto a http://PCa/xx/downloads/test.zip, then anything that results in a direct download, always shows error 400 ( bad request) on the client)
any thoughts ?
That Partly works.
If I goto http://PCa/xx, then that works correctly, re-directs to http://PCb:8282/ and displays the correct webpage on the new host. - Great
If however I goto a http://PCa/xx/downloads/test.zip, then anything that results in a direct download, always shows error 400 ( bad request) on the client)
any thoughts ?
OK, try replacing this line:
with this:
Dan
<action type="Redirect" url="http://PCb:8282/{R:1}" redirectType="Permanent" />
with this:
<action type="Redirect" url="http://PCb:8282/{R:0}" redirectType="Permanent" />
Dan
ASKER
Hi Dan,
Thanks, but sadly no change. still results in error 400
The Full link, ( as a direct url that works) , and without going through the URL Rewrite is :
http://PCb:8282/repository/download/Products_A00236_Fpga0/486:id/packages/bit_file/test.zip
The Full link, that does not work ( and generated error 400 ) is
http://PCa/xx/repository/download/Products_A00236_Fpga0/486:id/packages/bit_file/test.zip
The system at PCb:8282 is Teamcity ( a continuous integration server). The point of the exercise is to provide an alias to the users so that if I ever needed to move the Teamcity server, the http://PCa/xx link will always be valid. This is critical because our PLM system will be making virtual links to the file outputs from the Teamcity system, and thus this alias provides a guaranteed link mechanism.
Does the URL Rewrite need an outbound rule to accept the file coming back from the Teamcity server ?
Thanks, but sadly no change. still results in error 400
The Full link, ( as a direct url that works) , and without going through the URL Rewrite is :
http://PCb:8282/repository/download/Products_A00236_Fpga0/486:id/packages/bit_file/test.zip
The Full link, that does not work ( and generated error 400 ) is
http://PCa/xx/repository/download/Products_A00236_Fpga0/486:id/packages/bit_file/test.zip
The system at PCb:8282 is Teamcity ( a continuous integration server). The point of the exercise is to provide an alias to the users so that if I ever needed to move the Teamcity server, the http://PCa/xx link will always be valid. This is critical because our PLM system will be making virtual links to the file outputs from the Teamcity system, and thus this alias provides a guaranteed link mechanism.
Does the URL Rewrite need an outbound rule to accept the file coming back from the Teamcity server ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Dan, Brilliant solution.
That just works :-)
That just works :-)
Open in new window
References:
1. http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
2. http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
3. http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/
--- check out point #3
4. http://weblogs.asp.net/owscott/url-parts-available-to-url-rewrite-rules
Dan