Forum Discussion
skarpovi_111573
Nimbostratus
Apr 09, 2008HTTP::header insert
tried to use simple rule with HTTP::header insert, but don't see anything in TCP dump. it does redirect to https, however - no string in the header
when HTTP_REQUEST {
if {[TCP::local_port] eq "80"} {
HTTP::header insert STRING "MLint"
HTTP::redirect "https://[HTTP::host][HTTP::uri]test"
} elseif {[TCP::local_port] eq "80" } {
HTTP::redirect "http://[HTTP::host][HTTP::uri]"
} else {
pool test-Servers-Pool
}
}
- hoolio
Cirrostratus
I'm not sure that using HTTP::header insert with HTTP::redirect is expected to work. Can you try using HTTP::respond (Click here) instead? - Nicolas_Menant
Employee
I'm sure it won't work this way - skarpovi_111573
Nimbostratus
tried to test this rule, but still no STRING incerted in the HTTP header? not sure if i'm doing something wrong.when HTTP_REQUEST { if {[TCP::local_port] eq "80"} { HTTP::respond 302 Location "https://[HTTP::host][HTTP::uri]test" STRING "MLint" } elseif {[TCP::local_port] eq "80" } { HTTP::redirect "http://[HTTP::host][HTTP::uri]" } else { pool test-Servers-Pool } }
- hoolio
Cirrostratus
The HTTP::respond command you're using would insert the header named STRING with a value of MLint in the 302 response to the client. - skarpovi_111573
Nimbostratus
i'll try to do my best to explain, and can e-mail you diagram. - Based on your request
when HTTP_REQUEST { if { [TCP::local_port] eq 80 } { Send HTTP redirect to browser HTTP::redirect "https://[HTTP::host][HTTP::uri]test" } else { Add header with name "STRING" and value "MLint" to be sent to backend webserver HTTP::header insert STRING "MLint" } }
- skarpovi_111573
Nimbostratus
looks like i made some progress, so now is a question, how to do incert in the cookies - hoolio
Cirrostratus
You can insert and/or manipulate a cookie using the HTTP::cookie commands (Click here): - skarpovi_111573
Nimbostratus
how to put cookie in this line instead of STRING? - hoolio
Cirrostratus
Sorry for the confusion. If you're trying to set a cookie in the redirect you send with HTTP::respond, you can use this format:
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