httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59829] Detect HTTPS marker from reverse proxy
Date Tue, 31 Jan 2017 10:42:54 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=59829

--- Comment #10 from Jean Weisbuch <jean@phpnet.org> ---
(In reply to Jean Weisbuch from comment #9)
> Its unfortunately still not enough for the HTTPS variable to work with
> mod_rewrite, such rewriterules will not work and create a redirect loop :
>     RewriteCond %{HTTPS} !=on
>     RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
> 
> 
> Its not working because mod_rewrite doesnt rely on the "HTTPS" variable but
> it does call the mod_ssl function "ssl_is_https()".
> The code calling this function is located in "lookup_variable()" in
> mod_rewrite.c where it does :
>     int flag = rewrite_is_https && rewrite_is_https(r->connection);
> 
> 
> 
> So far i havent found a simple solution to this issue that wouldnt involve
> modifying mod_rewrite (or mod_ssl).

A way to fix it by modifying mod_rewrite (which is not a proper solution) :

--- modules/mappers/mod_rewrite.c.orig  2016-12-14 23:27:25.000000000 +0100
+++ modules/mappers/mod_rewrite.c       2017-01-31 11:36:46.162667272 +0100
@@ -1923,7 +1923,8 @@

         case  5:
             if (!strcmp(var, "HTTPS")) {
-                int flag = rewrite_is_https &&
rewrite_is_https(r->connection);
+                int flag = (rewrite_is_https &&
rewrite_is_https(r->connection)) || apr_table_get(r->connection->notes,
"remoteip_env_https");
                 return apr_pstrdup(r->pool, flag ? "on" : "off");
             }
             break;

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message