Skip to content

A free, self-hostable news aggregator…

Better support for HTTP_X_FORWARDED_PROTO (#2037)

Alexandre Alapetiteba000d0e0861
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index e21697e42..24e30546f 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -129,6 +129,8 @@ class Minz_Request {
if (!empty($_SERVER['HTTP_X_FORWARDED_PORT'])) {
$port = intval($_SERVER['HTTP_X_FORWARDED_PORT']);
+ } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
+ $port = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https' ? 443 : 80;
} elseif (!empty($_SERVER['SERVER_PORT'])) {
$port = intval($_SERVER['SERVER_PORT']);
} else {