/ Zope / Apsis / Pound Mailing List / Archive / 2017 / 2017-02 / http to https redirect from Apache backend

[ << ] [ >> ]

[ Use variables values / Narcis Garcia ... ] [ Confuring Pound to work with seperate ... ]

http to https redirect from Apache backend
Narcis Garcia <informatica(at)actiu.net>
2017-02-10 20:33:26 [ FULL ]
[using Pound 2.6 with Apache backends]

Hello, I've been trying to use .htaccess in Apache sites with this:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
[L,R=301,NE]

But client browser says "the server is redirecting the request for this
address in a way that will never complete"
I've been doing many tests and it seems to be a problem between Apache's
redirect and Pound frontend.
This pound installation only receives traffic for port 80.
If I try:
RewriteRule ^ https://www.example.net%{REQUEST_URI}
[L,R=301,NE]
Redirects perfectly because target URL doesn't point to this Pound service.

What can I do to allow this type of redirection with Apache's rewrite?

Thanks.

Re: [Pound Mailing List] http to https redirect from Apache backend
Alexander Kolodziej <alexander.kolodziej(at)tactel.se>
2017-02-11 12:42:46 [ FULL ]
Try setting

RewiteLocation 0

from man page:

        RewriteLocation 0|1|2
               If 1 force Pound to change the Location: and 
Content-location: headers in responses. If they point to the back-end 
itself or to the listener (but with the wrong protocol) the response will be
               changed  to  show  the  virtual host in the request. 
Default: 1 (active).  If the value is set to 2 only the back-end address 
is compared; this is useful for redirecting a request to an HTTPS
               listener on the same server as the HTTP listener.


On 2017-02-10 20:33, Narcis Garcia wrote:[...][...]

Re: [Pound Mailing List] http to https redirect from Apache backend
Narcis Garcia <informatica(at)actiu.net>
2017-02-11 17:02:51 [ FULL ]
Thanks; it didn't worked because the problem was (my fault) the lack of
X-Forwarded-Proto header from port 443 visits (without proxy*).

Solved adding to listener:
AddHeader "X-Forwarded-Proto: http"
And reversing one logic of Apache directive to:
RewriteCond %{HTTP:X-Forwarded-Proto} http

Thanks.

(*) I use sltd with SNI, no proxying.


El 11/02/17 a les 12:42, Alexander Kolodziej ha escrit:[...][...]

Re: [Pound Mailing List] http to https redirect from Apache backend
alejandrohiniesta(at)gmail.com
2017-02-11 18:18:52 [ FULL ]
Enviado desde mi iPhone
[...][...]
>>> On 2017-02-10 20:33, Narcis Garcia wrote:
>>> [using Pound 2.6 with Apache backends]
>>> 
>>> Hello, I've been trying to use .htaccess in Apache sites with
this:
>>> 
>>> RewriteEngine On
>>> RewriteCond %{HTTP:X-Forwarded-Proto} !https
>>> RewriteCond %{ENV:HTTPS} !on
>>> RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
>>> 
>>> But client browser says "the server is redirecting the request for
this
>>> address in a way that will never complete"
>>> I've been doing many tests and it seems to be a problem between
Apache's
>>> redirect and Pound frontend.
>>> This pound installation only receives traffic for port 80.
>>> If I try:
>>> RewriteRule ^ https://www.example.net%{REQUEST_URI}
[L,R=301,NE]
>>> Redirects perfectly because target URL doesn't point to this Pound
>>> service.
>>> 
>>> What can I do to allow this type of redirection with Apache's
rewrite?
>>> 
>>> Thanks.
>>> 
>>> -- 
>>> To unsubscribe send an email with subject unsubscribe to
pound(at)apsis.ch.
>>> Please contact roseg(at)apsis.ch for questions.
>>> [...][...]

MailBoxer