Re: [Pound Mailing List] Too many redirects

2013-06-19 Thread Alan McGinlay
Hmm, I'm not awesome at spotting that kind of issue (sounds like one of 
those things you stare at for hours before noticing something really 
obvious :) )


A good start would be to enable redirect logging in Apache as this will 
tell you exactly what is going on:


RewriteLog /var/log/apache/rewrite.log
RewriteLogLevel 5 # higher numbers give more info, 5 is good start


Also, have you tried watching the headers during the requests? I use 
firefox extension live http headers really great for finding this kind 
of issue.


https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/

Chrome has something similar but it's not as good.

My personal preference is to do those simple redirects in Pound, as you 
are now doing, as it saves a pointless request to the backend.


Unfortunately Pound doesn't support paths in the destination 
(url.com/path.html - url.com/newpath.html) or I would use it for all my 
redirects.


/A

On 2013-06-19 10:03, Martijn de Dood wrote:

I've setup pound on my Debian Squeeze server (pound package from the
repository 2.5-1) with the following config:

## Minimal sample pound.cfg
##
## see pound(8) for details

##
## global options:

Userwww-data
Groupwww-data
#RootJail/chroot/pound

## Logging: (goes to syslog by default)
##0no logging
##1normal
##2extended
##3Apache-style (common log format)
LogLevel0

## check backend every X secs:
Alive30

## use hardware-accelleration card supported by openssl(1):
#SSLEnginehw

# poundctl control socket
Control /var/run/pound/poundctl.socket


##
## listen, redirect and ... to:

## redirect all requests on port 8080 (ListenHTTP) to the local
webserver (see Service below):
ListenHTTP
Address 111.111.111.111 # My external IP
Port80

## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
xHTTP0

Service
BackEnd
Address127.0.0.1
Port80
End
End
End


Apache is running on localhost port 80.
When I visit my site via mysite.com all goes well. However when visiting
my site via www.mysite.com the browser replies with too many redirects.

The website on Apache has a .htaccess file which does the redirect from
www.mysite.com to mysite.com

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]


If I setup nginx as a reverse proxy I don't get too many redirects when
requesting www, but I don't want nginx I like Pound more.
What could cause the problem of the loop?

I made a fix with this:

Service
HeadRequire ^Host: www.mysite.com$
Redirect 301 http://mysite.com;
End

But I would like to know why the loop occurs and if there is a other
solution.





--
To unsubscribe send an email with subject unsubscribe to pound@apsis.ch.
Please contact ro...@apsis.ch for questions.


Re: [Pound Mailing List] Too many redirects

2013-06-19 Thread poundlist
my experience if redirects from backend dont work properly, is to tune 
with the RewriteLocation option. for example add

RewriteLocation 2
to your listener...

good luck and cheers.ivo

On 06/19/2013 10:45 AM, Alan McGinlay wrote:

Hmm, I'm not awesome at spotting that kind of issue (sounds like one of
those things you stare at for hours before noticing something really
obvious :) )

A good start would be to enable redirect logging in Apache as this will
tell you exactly what is going on:

RewriteLog /var/log/apache/rewrite.log
RewriteLogLevel 5 # higher numbers give more info, 5 is good start


Also, have you tried watching the headers during the requests? I use
firefox extension live http headers really great for finding this kind
of issue.

https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/

Chrome has something similar but it's not as good.

My personal preference is to do those simple redirects in Pound, as you
are now doing, as it saves a pointless request to the backend.

Unfortunately Pound doesn't support paths in the destination
(url.com/path.html - url.com/newpath.html) or I would use it for all my
redirects.

/A

On 2013-06-19 10:03, Martijn de Dood wrote:

I've setup pound on my Debian Squeeze server (pound package from the
repository 2.5-1) with the following config:

## Minimal sample pound.cfg
##
## see pound(8) for details

##
## global options:

Userwww-data
Groupwww-data
#RootJail/chroot/pound

## Logging: (goes to syslog by default)
##0no logging
##1normal
##2extended
##3Apache-style (common log format)
LogLevel0

## check backend every X secs:
Alive30

## use hardware-accelleration card supported by openssl(1):
#SSLEnginehw

# poundctl control socket
Control /var/run/pound/poundctl.socket


##
## listen, redirect and ... to:

## redirect all requests on port 8080 (ListenHTTP) to the local
webserver (see Service below):
ListenHTTP
Address 111.111.111.111 # My external IP
Port80

## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
xHTTP0

Service
BackEnd
Address127.0.0.1
Port80
End
End
End


Apache is running on localhost port 80.
When I visit my site via mysite.com all goes well. However when visiting
my site via www.mysite.com the browser replies with too many redirects.

The website on Apache has a .htaccess file which does the redirect from
www.mysite.com to mysite.com

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]


If I setup nginx as a reverse proxy I don't get too many redirects when
requesting www, but I don't want nginx I like Pound more.
What could cause the problem of the loop?

I made a fix with this:

Service
HeadRequire ^Host: www.mysite.com$
Redirect 301 http://mysite.com;
End

But I would like to know why the loop occurs and if there is a other
solution.





--
To unsubscribe send an email with subject unsubscribe to pound@apsis.ch.
Please contact ro...@apsis.ch for questions.



--
To unsubscribe send an email with subject unsubscribe to pound@apsis.ch.
Please contact ro...@apsis.ch for questions.


Re: [Pound Mailing List] Too many redirects

2013-06-19 Thread Paolo Nesti Poggi

Have tried removing the space between ^ and http ?
/paolo

Den 19-06-2013 10:59, poundl...@toastbrot.ch skrev:
 RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

--
To unsubscribe send an email with subject unsubscribe to pound@apsis.ch.
Please contact ro...@apsis.ch for questions.


RE: [Pound Mailing List] Too many redirects

2013-06-19 Thread Martijn de Dood
Sorry.Did not hit reply but started a new message.
Thanks for all the answers.
Removing the space between ^ and http stops the loop but it also doesn't 
rewrite anymore.It also occurs when doing in PHP a location / redirect 301.
RewriteLocation:This was the solution.When setting rewritelocation to 0 the 
redirects are working.
Tnx!  

RE: [Pound Mailing List] Too many redirects

2013-06-19 Thread Martijn de Dood
Sorry.Did not hit reply but started a new message.


From: mded...@hotmail.com
To: pound@apsis.ch
Date: Wed, 19 Jun 2013 12:33:14 +0200
Subject: [Pound Mailing List] Too many redirects




Thanks for all the answers.
Removing the space between ^ and http stops the loop but it also doesn't 
rewrite anymore.It also occurs when doing in PHP a location / redirect 301.
RewriteLocation:This was the solution.When setting rewritelocation to 0 the 
redirects are working.
Tnx!