Forum Discussion
CraigyB_172365
Nimbostratus
Jan 12, 2018HOST and partial path rewrite
Hi I am new to F5 and am trying to do a URL rewrite a chunk of the URL. I think I am on the right track but I just cannot make it work. Any help is really appreciated.
I just want to replace any...
nitass
Employee
Jan 12, 2018I just need to redirect / rewwrite requests that come in to F5-VIP-Jenkins/info to jenkins-server:9000/jenkins_info. while still persisting any additional path that is supplied. So F5-VIP-Jenkins/info/project1 would redirect to jenkins-server:9000/jenkins_info/project1.
just another example
e.g.
// config
root@(ve13a)(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
}
translate-address enabled
translate-port enabled
vs-index 17
}
root@(ve13a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo
ltm pool foo {
members {
200.200.200.101:9000 {
address 200.200.200.101
}
}
}
root@(ve13a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when HTTP_REQUEST_RELEASE {
if { [HTTP::uri] starts_with "/info/" } {
HTTP::host "[LB::server addr]:[LB::server port]"
HTTP::uri [string map {"/info/" "/jenkins_info/"} [HTTP::uri]]
}
}
}
// test
[root@ve13a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80 or port 9000
New TCP connection 1: 172.28.24.1(42574) <-> 172.28.24.10(80)
1515777465.5177 (0.0006) C>S
---------------------------------------------------------------
GET /info/project1/helloworld HTTP/1.1
User-Agent: curl/7.29.0
Host: 172.28.24.10
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.14(3889) <-> 200.200.200.101(9000)
1515777465.5189 (0.0011) C>S
---------------------------------------------------------------
GET /jenkins_info/project1/helloworld HTTP/1.1
User-Agent: curl/7.29.0
Host: 200.200.200.101:9000
Accept: */*
---------------------------------------------------------------
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