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:

User"www-data"
Group"www-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):
#SSLEngine"<hw>"

# 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.

Reply via email to