View Issue Details

IDProjectCategoryView StatusLast Update
0009077mantisbtadministrationpublic2009-06-23 15:28
ReporterahalliganAssigned Tojreese 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.1.1 
Target Version1.2.0rc1Fixed in Version1.2.0rc1 
Summary0009077: [PATCH] Mantis does not handle forwarded protocol correclty when behind a proxy
Description

When I run mantis from behind a public proxy and forward https -> http, I experience a problem similar to issue# 0006134. I want to be able to have users access mantis securely from a public address https://mantis.mydomain.com and developers access mantis on the internal network at http://localserver/

To get things to work properly I simply tweaked the config_defaults_inc.php with the following (please also find patch attached):

$t_protocol = 'http';
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) { // Support ProxyPass
$t_protocol= $_SERVER['HTTP_X_FORWARDED_PROTO'];
} else if ( isset( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
$t_protocol = 'https';
}

This has the system working in both scenarios. Would be great if this tweak could make its way into the next release.

Tagspatch

Activities

2008-04-15 23:49

 

Forwarded Protocol.patch (672 bytes)
Index: mantisbt/config_defaults_inc.php
===================================================================
--- mantisbt/config_defaults_inc.php	(revision 5166)
+++ mantisbt/config_defaults_inc.php	(working copy)
@@ -69,7 +69,9 @@
 	# requires trailing /
 	if ( isset ( $_SERVER['PHP_SELF'] ) ) {
 		$t_protocol = 'http';
-		if ( isset( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
+		if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) { // Support ProxyPass
+			$t_protocol= $_SERVER['HTTP_X_FORWARDED_PROTO'];
+		} else if ( isset( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
 			$t_protocol = 'https';
 		}
 
jreese

jreese

2009-03-30 10:19

reporter   ~0021289

Fix committed to 1.2.x development tree.

Related Changesets

MantisBT: master e9185997

2009-03-30 13:59:59

jreese

Details Diff
Fix 0009077: support the HTTP_X_FORWARDED_PROTO header.
mod - config_defaults_inc.php Diff File

Issue History

Date Modified Username Field Change
2008-04-15 23:49 ahalligan New Issue
2008-04-15 23:49 ahalligan File Added: Forwarded Protocol.patch
2008-07-13 15:33 vboctor Tag Attached: patch
2008-07-13 15:33 vboctor Status new => acknowledged
2008-07-13 15:33 vboctor Target Version => 1.2.0
2009-03-30 10:19 jreese Note Added: 0021289
2009-03-30 10:19 jreese Status acknowledged => resolved
2009-03-30 10:19 jreese Fixed in Version => 1.2.2
2009-03-30 10:19 jreese Resolution open => fixed
2009-03-30 10:19 jreese Assigned To => jreese
2009-03-30 10:20 jreese Changeset attached master e9185997 =>
2009-06-23 15:28 jreese Status resolved => closed