Forum Discussion
Drop requests with changes in hostname.
Alfonso_Santia2 Based on the customer request you do not have to issue the 302 redirect unless for some reason you are going from HTTP to HTTPS which doesn't seem to have been specified in the information provided above for the desired behavior. Because this was not mentioned the following iRule should do what you are expecting and it does not have a redirect because again that doesn't seem to be part of the expected behavior. If this is indeed an iRule associated to an HTTP virtual server (VS) and it needs to redirect to HTTPS we can amend the iRule accordingly. You can also adjust the logging line in the else part of the if else statement to provide other data rather than just "Is host ${host}" in the output to your log.
when CLIENT_ACCEPTED priority 500 {
set DEFAULT_POOL [LB::server pool]
}
when HTTP_REQUEST priority 500 {
set HOST [HTTP::host]
if { ${HOST} != "test.bank.com" } {
log local0. "400 ${HOST}"
HTTP::respond 400 -version auto content "Bad Request" "Content-Type" "text/html"
} else {
log local0. "Is host ${HOST}"
pool $DEFAULT_POOL
}
}
- Alfonso_Santia2Feb 23, 2023Altostratus
Thank you for your reply. We will test this during the weekend and inform you what happens. Thanks again.
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