Forum OpenACS Development: Re: ns_set returns "" when proxy_mode is true

Collapse
Posted by Iuri Sampaio on
Hi there,

It seems there's a bug on Naviserver, running behind NGINX and HTTPS.

The error happens only when proxy_mode is assigned "true" within NS config-file.tcl

Then, It returns "", instead of 0/1, in the command line [ns_set iget [ns_conn headers] X-SSL-Request], wihin ad_proc ad_conn

Then, it breaks collaterally an IF statement within the file packages/acs-tcl/tcl/utilities-procs.tcl, at line 2761

...
if { [ad_conn behind_proxy_p] } {
#
# We are running behind a proxy
#
#
if {[ad_conn behind_secure_proxy_p] } {
...

####

File: packages/acs-tcl/tcl/request-processor-procs.tcl
...
behind_secure_proxy_p {
#
# Check, if we are running behind a secure proxy:
# a) [ad_conn behind_proxy_p] must be true
# b) the header-field X-SSL-Request must be 1
#
set ad_conn(behind_secure_proxy_p) 0
if {[ad_conn behind_proxy_p]} {
set ad_conn(behind_secure_proxy_p) [ns_set iget [ns_conn headers] X-SSL-Request]
}
return $ad_conn(behind_secure_proxy_p)
}

####

I wonder if it could be related to my Debian installation too.

Does anyone use NGINX with Naviserver behind of it? Haven't you got the same problem?

The error that shows in the browser is bellow.

[15/Sep/2018:14:08:55][4075.7ff64e7d3700][-conn:litli:0:0-] Error: rp_report_error: Error rendering error page (!)
expected boolean value but got ""
while executing
"if {[ad_conn behind_secure_proxy_p]} {
#
# We know, the request was an https request
#
set proto https..."
(procedure "util_current_location" line 42)
invoked from within
"util_current_location"
(procedure "security::get_register_subsite" line 3)
invoked from within
"security::get_register_subsite"
(procedure "::nsf::procs::ad_get_login_url" line 4)
invoked from within
"ad_get_login_url -return"
("uplevel" body line 66)
invoked from within
"uplevel {
ad_page_contract {
This is the highest level site specific master template.

Properties allowed