Forum Discussion
tim_pearson_938
Nimbostratus
Oct 10, 2008fooling a client and the server
I am trying to get an iPhone to connect to our iNotes server and neither are playing nice. I think I can fool it by using the F5. My issue is that the iNotes server will not accept an IP address as a valid host. I have been trying to get the F5 to rewrite the URL, but am having issues
iPhone ----http://10.10.2.20 -->F5 ---http://mail.domain.com--->inotes server
What I have so far:
when HTTP_REQUEST {
Check if requested host is an IP address
if {[HTTP::host] eq "10.10.2.20"}{
Rewrite HOST
[HTTP::host] "mail.domain.com"
}
pool Test_iNotes_pool
}
when HTTP_RESPONSE {
Check if response is a name
if {[HTTP::host] eq "mail.domain.com"}{
Rewrite return HOST
[HTTP::host] "10.10.2.20"
}
}
edited, because I forgot to anonymize
- hoolio
Cirrostratus
Hi tpearson,when HTTP_REQUEST { Check if host is an IP address if {[HTTP::host] eq "10.198.239.248"}{ Replace host header HTTP::header replace Host "newhost.example.com" } }
- tim_pearson_938
Nimbostratus
thanks, - hoolio
Cirrostratus
Is 'itself' an IP address or a hostname? Can you post an anonymized example? - tim_pearson_938
Nimbostratus
Using your example hoolio, works until the inotes server sends me a 302 to mail.domain.com. I am using snats on this since, both the client and the mail server are on the local subnet (not sure it that causes any issues) - hoolio
Cirrostratus
Something like this maybe?when HTTP_REQUEST { Set a flag to rewrite host in redirect responses set check_response 0 Check if host is an IP address if {[HTTP::host] eq "10.198.239.248"}{ Replace host header HTTP::header replace Host "newhost.example.com" Set a flag to rewrite host in redirect responses set check_response 1 } } when HTTP_RESPONSE { if {$check_response and [HTTP::is_redirect]}{ Rewrite the Location header to an IP HTTP::header replace Location [string map {newhost.example.com 10.198.239.248} [HTTP::header value Location]] } }
- tim_pearson_938
Nimbostratus
I used the above rule, but the F5 virtual server sends me a reset on my first request. - hoolio
Cirrostratus
Can you check the /var/log/ltm log file? There should be a TCL error listed. - tim_pearson_938
Nimbostratus
Here are the TCL errors in /var/log/ltm - hoolio
Cirrostratus
I think that's an error from your previous rule. Can you retest and check for new errors? You can copy the ltm log file to a backup and clear it using the following: - tim_pearson_938
Nimbostratus
sorry, wrong rule,
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