Forum Discussion
http to https redirection for selected IPs
I am using following irule to direct internal requests to port 80 and external requests to port 443, private_IP datagroup contains the IP which are required to go to port 80, all else should be redirected to https. As a result external http requests are redirecting to https, but internally when I try VIP then it forwards to port 80, and if I use URL then it takes me to https, where as requirement is that URL requests from inside should go to 80, added the FW PAT IP in data group but still URL from inside is redirecting to https.
when HTTP_REQUEST {
Check if client IP is in the datagroup
if {[matchclass [IP::client_addr] equals $::private_IP]}{
pool xyz
} else {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
}
Thanks
3 Replies
- hoolio
Cirrostratus
Hi Varun,
If you're on 9.4.4 or higher, remove the $:: prefix from the private_IP data group name and it shoudl work.
Aaron - varun_malik
Nimbostratus
Hi Aaron
Thanks for reply, I tried it but still not working. When I try with VIP then it lands on http, but when I try with URL even from internal IPs then it goes to https, seems like it is not referring to data group when using URL. - Kevin_Stewart
Employee
Varun,
Try adding this log statement directly after the event declaration:log local0. "requesting [HTTP::host] from [IP::client_addr]"
It's possible that some DNS response to your URL request is sending you down a different path. Also try adding the host to your local HOSTS file for testing.
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