cache pages with apache auth
Tim Dunphy
bluethundr at gmail.com
Fri Jul 3 22:00:23 CEST 2015
Hey guys,
Thanks for your suggestions!! However, I'm still not having any luck. This
is what I tried. I logged into one of my webservers and then altered the
config so that it won't require authorization to access the healthcheck URL:
<VirtualHost *:80>
ServerName wiki.mydomain.com
ServerAlias www.wiki.mydomain.com
Options +Indexes +FollowSymlinks
LogLevel debug
ErrorLog logs/wiki-error.log
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/wiki-access_log common
DocumentRoot /var/www/jf/wiki
*SetEnvIf Request_URI ^/healthcheck.php/ noauth=1*
<Directory /var/www/jf/wiki>
Options Indexes
AuthType Basic
AuthName "JF Wiki Page"
AuthUserFile /etc/httpd/auth
Require valid-user
* Allow from env=noauth*
</Directory>
<Directory /var/www/jf/wiki/images>
Options -Indexes
</Directory>
</VirtualHost>
I've highlighted in bold what I changed in the config. Then copied the
config over to the other web server and restarted apache on both.
Both of the web hosts are still turning up as 'sick' in the varnish log:
0 Backend_health - web2 Went sick 4--X-R- 2 3 5 0.015589 0.000000
HTTP/1.1 401 Unauthorized
0 Backend_health - web1 Went sick 4--X-R- 2 3 5 0.045081 0.000000
HTTP/1.1 404 Not Found
So then I tried Paul's suggestion to tell varnish to expect a 401 response
for the probe. I'm not sure if I interpreted this request correctly, but
this is what I tried:
if ( req.url ~ "^/healthcheck.php") {
error 401;
}
And there was no change in the result after restarting varnish. Both web
servers are still turning up 'sick' in the varnish log.
Could I get some advice on where I'm going wrong here? And maybe if there
is another approach I could try, I'd be up for trying anything that might
work.
Thanks again for your help!!
Tim
On Mon, Jun 29, 2015 at 3:27 AM, Tobias Eichelbrönner <
tobias.eichelbroenner at lamp-solutions.de> wrote:
> Hi Tim,
>
> > Backend_health - web2 Still sick 4--X-R- 0 3 5 0.014946 0.000000
> > HTTP/1.1 401 Unauthorized
>
> seems to me your healthcheck on
> .url = "/healthcheck.php";
> does not send any authorization to your backend, so the probing fails.
> The most simple solution is the disable authorization for
> healthcheck.php in you Webserver.
>
> Keep in mind that if more then one user access your restricted area they
> probably get the cached contend from the other user delivered. You could
> put authorization header into the hash in give every user a different
> password.
>
> Sincerely,
>
> Tobias
>
> --
> LAMP solutions GmbH
> Gostenhofer Hauptstrasse 35
> 90443 Nuernberg
>
> Amtsgericht Nuernberg: HRB 22366
> Geschaeftsfuehrer: Heiko Schubert
>
> Es gelten unsere allgemeinen Geschaeftsbedingungen.
> http://www.lamp-solutions.de/agbs/
>
> Telefon : 0911 / 376 516 0
> Fax : 0911 / 376 516 11
> E-Mail : support at lamp-solutions.de
> Web : www.lamp-solutions.de
> Facebook : http://www.facebook.com/LAMPsolutions
> Twitter : http://twitter.com/#!/lampsolutions
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
--
GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20150703/6dde0c48/attachment.html>
More information about the varnish-misc
mailing list