Forum Discussion
Redirect but keep the original url in the address bar
Given a domain hosted in our company orginalSite.com but this site should resolve to vendor site ex: vendorsite.com.
It can not be redirected because requirement is to keep orginalSite.com (original url) in the browser address bar.
Here are couple of I rules that I tried.
Try1: replacing host headers
when HTTP_REQUEST { HTTP::header replace Host "vendorsite.com" HTTP::uri "/UserAccount/Login" }
Try2:
when HTTP_REQUEST { set dest [lindex [RESOLV::lookup @8.8.8.8 -a "vendorsite.com"] 0] node $dest 443
}
Any help will greatly appreciated.
6 Replies
- VernonWells
Employee
The first approach is likely what you need; that is, replace the Host header and request URI path before it is submitted to the server. If you're running 11.5+:
when HTTP_REQUEST { HTTP::host "vendorsite.com" HTTP::path "/UserAccount/Login" }Is this not working as you expect?
Incidentally, you can also use a Local Traffic Policy:
- shashank_shetti
Nimbostratus
Vernon thanks for the response but it is not working.
Here is the error message from httpfox: [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
Yes we are on Version 11.5.2
- Josh_Hill_17083
Nimbostratus
You can try using proxypass irule to help with this. Not sure if it will 100% answer your question, but helpful with hostname shenanigans.
https://devcentral.f5.com/codeshare/proxypass-v10-v11
Rgds Josh
- VernonWells
Employee
@shashank - Is there an error in /var/log/ltm that appears when you make a request? If not, then the server is probably unhappy with the modified request. You can do two tests:
- From the BIG-IP, use
to make the modified request;curl - Run
on the BIG-IP to verify the result.tcpdump
For the first:
curl --resolve vendorsite.com:80: -V http:///UserAccount/Login 2>&1 | lesswhere is the IP address of the server. This will return the HTTP response. If it tries without working, then there is a path problem.
For the second:
tcpdump -i 0.0 -s0 -w /var/tmp/dump.pcap hostIf you are using SNAT, it must be:
tcpdump -i 0.0 -s0 -w /var/tmp/dump.pcap host or 'host and host 'Then retrieve the pcap file (/var/tmp/dump.pcap) and open it in Wireshark to see what's going on.
- From the BIG-IP, use
- Josh_Abaire
Nimbostratus
If the backend server is configured to serve content for vendorsite.com you may also want to consider rewriting the response header, incase the Location field exists it can also be changed. Something along these lines:
when HTTP_RESPONSE { if {[HTTP::header value "Location"] contains "vendorsite.com"} { HTTP::header replace Location [string map {"vendorsite.com" "originalsite.com"} }}
- shashank_shetti
Nimbostratus
Here is the final solution that I got it working. Thanks Vernon, Josh Hill, Josh for your responses.
when HTTP_REQUEST {
HTTP::host "vendorsite.com"
if { ([HTTP::uri] equals "/") } { HTTP::uri "/UserAccount/Login/" }
set dest [lindex [RESOLV::lookup @8.8.8.8 -a "vendorsite.com"] 0]
node $dest 443
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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