Forum Discussion
F5 LTM Vanity URL Rewrite
Hi all,
Pretty new to F5 and have taken over management of a pair. I am having trouble updating some rewrite vanity urls.
I need users to be able to put in the URL "example.com" and for the URL to stay the same but for the page to show contents from an external website of "test.com/test".
Currently we have this iRule in place:
when HTTP_REQUEST {
"example.com"
{
HTTP::header replace "Host" "placeholder.com"
HTTP::header insert "X-Forwarded-Host" "example.com"
HTTP::uri "/example[HTTP::uri]"
}
}
When I try to update the iRule I change the "placeholder.com" with "test.com" and update the HTTP:uri with "/example[HTTP::uri]" with "/test[HTTP::uri]" but when I then go to "example.com" I get the following error:
"Not found. HTTP Error 404. The requested resource is not found."
Just looking for some advice on where I'm possibly going wrong, stuff I need to be aware of or if someone can point me in the right direct.
Appreciate any info. Thanks.
nbresto If the client will always see example.com you probably want to do a sideband since you are having the F5 gather the content.
https://community.f5.com/t5/technical-articles/advanced-irules-sideband-connections/ta-p/275721
- nbrestoNimbostratus
Hi Paulius,
Do you have any examples of how the code would look? Still trying to wrap my head around sideband connections.
Try building the request and send it from the BIG-IP to the configured node(s) to see if you also get a status code of 404. Maybe you are requesting the wrong page. Below is an example with curl.
curl -v -k --resolve placeholder.com:443:<node_ip_address> https://placeholder.com/test/somepage.html
You can also add some extra debug logging to see what's actualy being send to the pool member. See: iRule to log HTTP Request and Response headers for specific client IPs (f5.com)
- nbrestoNimbostratus
Hi Niels,
Do I need a node set up for a rewrite to work? I'm able to http::redirect to the site (though the URL changes) so I figured I'd be able to rewrite as well or am I understand this wrong?
Hi nbresto,
For a rewrite to work a node is needed. A redirect is something else. Does the client after a redirect, still makes a connection via the F5 BIG-IP? Did you try testing with curl?
- nbrestoNimbostratus
Thanks guys. I'll take a look into those suggestions.
Recent Discussions
Related Content
* 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