logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache strips Authorization Basic Header
Author
hschmale



Joined: 23 Jun 2016
Posts: 3
Location: USA, Harrisburg

PostPosted: Thu 23 Jun '16 21:16    Post subject: Apache strips Authorization Basic Header Reply with quote

I have apache setup as a proxy for multiple websites, and it works fine for this. However, one of the sites needs to have the Authorization and HTTP authenication headers for it to work. How can I keep apache from stripping those headers when passing the request onto the target?

I need those headers for owncloud's webdav system to work.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 23 Jun '16 23:16    Post subject: Reply with quote

Possibly proxy-chain-auth

see: http://httpd.apache.org/docs/2.4/mod/mod_proxy_http.html
Back to top
hschmale



Joined: 23 Jun 2016
Posts: 3
Location: USA, Harrisburg

PostPosted: Mon 27 Jun '16 19:42    Post subject: Reply with quote

Could you supply a minimum working example of proxying using proxy-chain-auth? My current sample looks like the below.

Code:

ProxyPreserveHost On
    ProxyPass / https://192.168.122.104/
    ProxyPassReverse / https://192.168.122.104/
Back to top
hschmale



Joined: 23 Jun 2016
Posts: 3
Location: USA, Harrisburg

PostPosted: Mon 27 Jun '16 21:35    Post subject: Solved it Reply with quote

Code:

RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


Apparently if you apply this rewrite rule at the proxy, it will pass along the headers.
Back to top
tallandtree



Joined: 31 Mar 2016
Posts: 4
Location: NL

PostPosted: Mon 25 Jul '16 17:26    Post subject: Re: Solved it Reply with quote

hschmale wrote:
Code:

RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


Apparently if you apply this rewrite rule at the proxy, it will pass along the headers.


I've got the same issue, but in my case the RewriteRule doesn't help. Still having to login at about every click.
Code:

<VirtualHost *:80>
   ServerName myserver.company.com
   ServerAdmin admin@company.com

   ProxyRequests     Off
   ProxyPreserveHost On

   ProxyPass /error/ !

   <Proxy *>
      SetEnv proxy-chain-auth On
      SetEnv proxy-sendcl On
      AuthBasicAuthoritative Off

      RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
   </Proxy>

   ProxyPass        / http://servera.company.com/
   ProxyPassReverse / http://servera.company.com/

</VirtualHost>


Do you have any other relevant code in your conf?
Back to top
tallandtree



Joined: 31 Mar 2016
Posts: 4
Location: NL

PostPosted: Thu 28 Jul '16 10:45    Post subject: Re: Solved it Reply with quote

Note that I was not able to solve this in Apache 2.4. With Apache 2.2 it works without any issues though. Digging through the tcpdumps of both versions did not make me any wiser why it did not work with apache 2.4. Hope someone is able to explain how to do this in Apache 2.4.

Working configuration in Apache 2.2:
Code:
# Virtual Hosts
<VirtualHost *:80>
        ServerName myserver.domain.org
        ServerAdmin admin@domain.org

        ProxyRequests     off
        ProxyPreserveHost on
        KeepAlive On

        ProxyPass /error/ !

        <Proxy *>
                SetEnv proxy-initial-not-pooled 1
        </Proxy>

        ProxyPass        / http://myserver.domain.org/
        ProxyPassReverse / http://myserver.domain.org/

</VirtualHost>
Back to top


Reply to topic   Topic: Apache strips Authorization Basic Header View previous topic :: View next topic
Post new topic   Forum Index -> Apache