rp_force_host_redirect (private)
rp_force_host_redirect host_header location path query \
[ effective_location ]Defined in packages/acs-tcl/tcl/request-processor-procs.tcl
Build a ForceHostP redirect to the driver's configured location, or return an empty string when the request already uses that hostname. The path is decoded connection data; the query is the original encoded query string, not form data (in particular, not a POST request body). When supplied, effective_location preserves the current scheme and port (including proxy, container and SuppressHttpPort handling), but its request-derived hostname is replaced with the configured hostname.
- Parameters:
- host_header (required)
- location (required)
- path (required)
- query (required)
- effective_location (optional)
- Returns:
- encoded absolute redirect URL, or an empty string
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- rp_force_host_redirect
Source code: if {$host_header eq ""} { return "" } util::split_host $host_header host port if {![util::split_location $location proto desired_host desired_port]} { error "ForceHostP: invalid configured location" } if {[string equal -nocase $host $desired_host]} { return "" } if {$effective_location ne ""} { set effective [ns_parseurl $effective_location] set authority [expr {[string first : $desired_host]>=0 ? "\[$desired_host\]" : $desired_host}] set location [dict get $effective proto]://$authority if {[dict exists $effective port]} { append location :[dict get $effective port] } } set url [string trimright $location /][ad_urlencode_folder_path $path] if {$query ne ""} { append url ?$query } return $urlXQL Not present: Generic, PostgreSQL, Oracle