Forum Discussion
ProxyPass V10 bug
I've noticed a bug in the way some stream rewrites are being done. If the replacement content is within a uri, this function will cut off the part before the matching string as described in the debug snippet below. I don't know enough to fix it, but it has to do with searching the entire URI for $host_serverside then assuming that must be at the beginning during the header replace function.
Checking Location=https://other.xx.xxx/?wtrealm=https%3a%2f%2fserverside.xx.xxx&wctx=rm, $protocol=https Changing response header Location: https://other.xx.xxx/?wtrealm=https%3a%2f%2fserverside.xx.xxx&wctx=rm with https://clientside.xx.xxx&wctx=rm
Fix Location, Content-Location, and URI headers
foreach header { "Location" "Content-Location" "URI"} {
set protocol [URI::protocol [HTTP::header $header]]
if { $static::ProxyPassDebug > 1 } {
log local0. "$log_prefix: Checking $header=[HTTP::header $header], \$protocol=$protocol"
}
if {$protocol ne ""} {
set server_path [findstr [HTTP::header $header] $host_serverside [string length $host_serverside]]
if {$server_path starts_with $path_serverside} {
if { $static::ProxyPassDebug } {
log local0. "$log_prefix: Changing response header $header: [HTTP::header $header] with $protocol://$host_clientside$path_clientside[substr $server_path [string length $path_serverside]]"
}
HTTP::header replace $header $protocol://$host_clientside$path_clientside[substr $server_path [string length $path_serverside]]
}
}
}
3 Replies
- Simon_Kowallik1Historic F5 Account
could you post your configuration (datagroup content)?
- BenT
Altocumulus
Sure. clientside.xx.xxx:=serverside.xx.xxx
- Simon_Kowallik1Historic F5 Account
try with this code block:
Fix Location, Content-Location, and URI headers foreach header { "Location" "Content-Location" "URI"} { set protocol [URI::protocol [HTTP::header $header]] if { $static::ProxyPassDebug > 1 } { log local0. "$log_prefix: Checking $header=[HTTP::header $header], \$protocol=$protocol" } if {$protocol ne ""} { set server_path [findstr [HTTP::header $header] $host_serverside [string length $host_serverside]] if {$server_path starts_with $path_serverside} { if {[HTTP::header $header] starts_with "$protocol://$host_serverside"} { if { $static::ProxyPassDebug } { log local0. "$log_prefix: Changing response header $header: [HTTP::header $header] with $protocol://$host_clientside$path_clientside[substr $server_path [string length $path_serverside]]" } HTTP::header replace $header $protocol://$host_clientside$path_clientside[substr $server_path [string length $path_serverside]] } else { if { $static::ProxyPassDebug } { set hdr_rplc [string map "$host_serverside $host_clientside $path_serverside $path_clientside" [HTTP::header $header]] log local0. "$log_prefix: Changing response header $header: [HTTP::header $header] with $hdr_rplc" unset hdr_rplc } HTTP::header replace $header [string map "$host_serverside $host_clientside $path_serverside $path_clientside" [HTTP::header $header]] } } } }
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