-
-
Save vguerra/6ae69309b3ece8c15603 to your computer and use it in GitHub Desktop.
OpenACS running behind proxy ( support for ssl )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: config.tcl | |
=================================================================== | |
RCS file: /cvsroot/openacs-4/etc/config.tcl,v | |
retrieving revision 1.55 | |
diff -u -p -r1.55 config.tcl | |
--- config.tcl 8 Nov 2010 20:10:14 -0000 1.55 | |
+++ config.tcl 13 Feb 2012 14:06:29 -0000 | |
@@ -43,6 +43,9 @@ set servername "New OpenA | |
set serverroot "/var/www/${server}" | |
+# Are we runnng behind a proxy? | |
+set proxy_mode false | |
+ | |
#--------------------------------------------------------------------- | |
# which database do you want? postgres or oracle | |
set database postgres | |
@@ -109,6 +112,7 @@ ns_section ns/parameters | |
ns_param OutputCharset utf-8 | |
ns_param URLCharset utf-8 | |
+ ns_param ReverseProxyMode $proxy_mode | |
#--------------------------------------------------------------------- | |
# Thread library (nsthread) parameters | |
#--------------------------------------------------------------------- | |
Index: ../packages/acs-tcl/tcl/utilities-procs.tcl | |
=================================================================== | |
RCS file: /cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v | |
retrieving revision 1.127 | |
diff -u -p -r1.127 utilities-procs.tcl | |
--- ../packages/acs-tcl/tcl/utilities-procs.tcl 30 Oct 2010 21:43:01 -0000 1.127 | |
+++ ../packages/acs-tcl/tcl/utilities-procs.tcl 13 Feb 2012 14:06:29 -0000 | |
@@ -2511,7 +2511,13 @@ ad_proc -public util_current_location {{ | |
set port $Host_port | |
} | |
} | |
- | |
+ | |
+ if { [ns_config "ns/parameters" ReverseProxyMode] == "true" } { | |
+ if { [ns_set iget [ad_conn headers] X-Forwarded-For] != "" && [ns_set iget [ad_conn headers] X-SSL-Request] == "1"} { | |
+ set proto https | |
+ } | |
+ } | |
+ | |
if { $port ne "" && $port ne $default_port($proto) } { | |
return "$proto://$hostname:$port" | |
} else { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment