2014-11-23 20:02 EST

View Issue Details Jump to Notes ] Wiki ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0009077mantisbtadministrationpublic2009-06-23 15:28
Reporterahalligan 
Assigned Tojreese 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
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
DescriptionWhen 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
Attached Files
  • patch file icon Forwarded Protocol.patch (672 bytes) 2008-04-15 23:49 - 
    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';
     		}
     
    
    patch file icon Forwarded Protocol.patch (672 bytes) 2008-04-15 23:49 + 

- Relationships
+ Relationships

-  Notes
User avatar

~0021289

jreese (reporter)

Fix committed to 1.2.x development tree.
+  Notes

+ Related Changesets

- 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-04-15 23:53 ahalligan Note Added: 0017607
2008-04-16 00:30 ahalligan Note Deleted: 0017607
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
+ Issue History