[Pound Mailing List] pound does not handle server-generated redirect well and drops hostname from location

Dave Atkins <[email protected]>
Newsgroups gmane.comp.web.pound.general
Message-ID <[email protected]>
Hello pound group,

I have run into a perplexing problem where I am not sure if the issue is
pound or the third party module. Please bear with me as I describe. I
believe I am failing to pass something in the headers but not sure...

I have pound + varnish + apache to serve multiple Drupal sites. For one of
those sites (www.ceeforum.org), I am using pound to force SSL. For other
sites (www.cee1.org), it just passes through.

pound :80/:443
varnish :8081
apache: 8080

The problem comes with the third party module "CiviCRM" CiviCRM, among
other things, sends out emails with click-tracking urls embeded like this:

https://www.ceeforum.org/sites/all/modules/civicrm/extern/url.php?u=2810&qid=50742

upon hitting the url.php script, the actual destination url is looked up
and user is redirected via a 302 location: header.

The problem is that when the destination url is a hostname on the same
server, the hostname is replaced by the local site url. The correct
destination url is "www.cee1.org/ar" but instead it sends the user to "
www.ceeforum.org/ar"

To isolate the problem I have hit each component directly (details below)
apache and varnish work. I also disabled the SSL in pound but got the same
problem. This leads me to conclude the problem is in pound, although I
would not be surprised if CiviCRM is expecting something nonstandard that I
am failing to pass...

If anyone can help, please let me know!

Thank you!



Here is my pound.cfg:

######################################################################

## listen, redirect and ... to:


## redirect all requests on port 80 ("ListenHTTP") to the local webserver
(see "Service" below):

## varnish runs on 8081

## apache runs on 8080


ListenHTTP

Address 69.164.210.61

Port 80


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

#xHTTP 0


 Service

 HeadRequire "Host: www.ceeforum.org"

 Redirect "https://www.ceeforum.org"

        End


        Service

                HeadRequire "Host: forum.cee1.org"

                Redirect "https://forum.cee1.org"

        End


 Service

 BackEnd

 Address 127.0.0.1

 Port 8081

 End

End

End


ListenHTTPS

        HeadRemove "X-Forwarded-Proto"

        AddHeader "X-Forwarded-Proto: https"

        Address 69.164.210.61

        Port 443

        Cert "/home/www/cee.org/ssl/ceeforum-comodo.pem"

        Service

                BackEnd

                        Address 127.0.0.1

                        Port    8081

                End

        End

End
-----

This works fine through apache:

http://www.ceeforum.org:8080/sites/all/modules/civicrm/extern/url.php?u=2810&qid=50742

and it works with varnish:

datkins@WEBAPPS:~$ wget --server-response
http://www.ceeforum.org:8081/sites/all/modules/civicrm/extern/url.php?u=2810&qid=50739

[1] 4324

datkins@WEBAPPS:~$ --2014-07-08 16:03:03--
http://www.ceeforum.org:8081/sites/all/modules/civicrm/extern/url.php?u=2810

Resolving www.ceeforum.org... 69.164.210.61

Connecting to www.ceeforum.org|69.164.210.61|:8081... connected.

HTTP request sent, awaiting response...

  HTTP/1.1 302 Found

  Server: Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.5 with Suhosin-Patch
mod_ssl/2.2.11 OpenSSL/0.9.8g

  X-Powered-By: PHP/5.2.6-3ubuntu4.5

  Location: http://www.cee1.org/ar/

  Cache-Control: max-age=1

  Expires: Tue, 08 Jul 2014 20:03:04 GMT

  Vary: Accept-Encoding

  Content-Type: text/html

  Content-Length: 0

  Date: Tue, 08 Jul 2014 20:03:03 GMT

  X-Varnish: 261053747

  Age: 0

  Via: 1.1 varnish

  Connection: keep-alive

Location: http://www.cee1.org/ar/ [following]

--2014-07-08 16:03:03--  http://www.cee1.org/ar/

Resolving www.cee1.org... 69.164.210.61

Connecting to www.cee1.org|69.164.210.61|:80... connected.

HTTP request sent, awaiting response...

  HTTP/1.1 200 OK

  Server: Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.5 with Suhosin-Patch
mod_ssl/2.2.11 OpenSSL/0.9.8g

  X-Powered-By: PHP/5.2.6-3ubuntu4.5

  Set-Cookie: PHPSESSID=ef5538af8fdfbd1543c1602d755f7cba; path=/

  Expires: Thu, 19 Nov 1981 08:52:00 GMT

  Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0

  Pragma: no-cache

  Set-Cookie: dgxdonate=ef5538af8fdfbd1543c1602d755f7cba; expires=Tue,
15-Jul-2014 20:03:06 GMT; path=/; domain=www.cee1.org

  X-Pingback: http://www.cee1.org/ar/xmlrpc.php

  Link: <http://www.cee1.org/ar/>; rel=shortlink

  Vary: Accept-Encoding

  Content-Type: text/html; charset=UTF-8

  Content-Length: 20809

  Date: Tue, 08 Jul 2014 20:03:06 GMT

  X-Varnish: 261053748

  Age: 0

  Via: 1.1 varnish

  Connection: keep-alive

Length: 20809 (20K) [text/html]

Saving to: `index.html'


100%[======================================>] 20,809      --.-K/s   in 0s



2014-07-08 16:03:06 (331 MB/s) - `index.html' saved [20809/20809]


c


 ---
*Dave Atkins*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.