Forum Discussion
siyadh_121603
Nimbostratus
Aug 20, 2014Redirect Hostname
Hi,
We need to redirect "http://abc.com/regards/image1.gif" to "http://xyz.com/regards/image1.gif". As there is many images, so can we do rewrite only host name from "abc.com" to "xyz.com"..?
5 Replies
- nitass_89166
Noctilucent
e.g.
config root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 65 } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo ltm pool foo { members { 200.200.200.101:80 { address 200.200.200.101 } 200.200.200.111:80 { address 200.200.200.111 } } } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::path] ends_with ".gif" } { HTTP::header replace Host "xyz.com" } } } trace [root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.24.1(55054) <-> 172.28.24.10(80) 1408536817.7560 (0.0022) C>S --------------------------------------------------------------- GET /regards/image1.gif HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Accept: */* Host: abc.com --------------------------------------------------------------- New TCP connection 2: 200.200.200.14(55054) <-> 200.200.200.111(80) 1408536817.7888 (0.0293) C>S --------------------------------------------------------------- GET /regards/image1.gif HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Accept: */* Host: xyz.com ---------------------------------------------------------------- siyadh_121603
Nimbostratus
Hi Nitass, Thank you for your quick response. can we rewrite the hostname "abc.com" to "xyz.com"...? because there is many extension and path...?
- nitass
Employee
e.g.
config root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 65 } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo ltm pool foo { members { 200.200.200.101:80 { address 200.200.200.101 } 200.200.200.111:80 { address 200.200.200.111 } } } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::path] ends_with ".gif" } { HTTP::header replace Host "xyz.com" } } } trace [root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.24.1(55054) <-> 172.28.24.10(80) 1408536817.7560 (0.0022) C>S --------------------------------------------------------------- GET /regards/image1.gif HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Accept: */* Host: abc.com --------------------------------------------------------------- New TCP connection 2: 200.200.200.14(55054) <-> 200.200.200.111(80) 1408536817.7888 (0.0293) C>S --------------------------------------------------------------- GET /regards/image1.gif HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Accept: */* Host: xyz.com ---------------------------------------------------------------- siyadh_121603
Nimbostratus
Hi Nitass, Thank you for your quick response. can we rewrite the hostname "abc.com" to "xyz.com"...? because there is many extension and path...?
- nitass
Employee
can we rewrite the hostname "abc.com" to "xyz.com"...? because there is many extension and path...?
you can check whatever condition before rewriting. the example above does rewrite when user requests gif file extension.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects