Solved: Re: Question about designed solution with dynamic backend setup based on csv-file with backend Basic Authentication

Aleksandar Lazic al-varnishmisc at none.at
Tue Nov 11 01:11:05 CET 2014


Hi.

Answer for archive.

Am 21-09-2014 20:58, schrieb Aleksandar Lazic:
> Hi.
> 
> Am 18-02-2014 11:10, schrieb Lasse Karstensen:
>> On Thu, Feb 06, 2014 at 04:30:08PM +0100, Aleksandar Lazic wrote:
> 
> [..]
> 
>>> @2.) Write a script which create a $ID.vcl with the necessary
>>> "backend $ID { ...}" files.
>>>      This script add also a 'sub vcl_recv {...}' per backend with 
>>> header
>>> 
>>>      set req.http.Authorization = "BASIC [base64 encoded
>>> admin:adminpass]"
>> 
>> If this is for the backend connection/requests, you need to set it on 
>> bereq in
>> vcl_miss.
> 
> Sorry but I think I still not have fully understand varnish.
> 
> I need to change the request URL on the backend to another url and set
> the Authorization-Header.

This setup works for me.

########### default.vcl
vcl 4.0;

import std;

include "/etc/varnish/backends.vcl"; # the backends

sub vcl_recv {

     if (req.url ~ "^/229") {
       set req.backend_hint = Kunde_02_port_9001;
     }

}

sub vcl_backend_fetch {

     if (bereq.url ~ "^/229") {
       set bereq.url = "<UPSTREAM-URL>";
       set bereq.http.authorization = "Basic <The-Password-Encoded>";
       return (fetch);
     }
}
############

Cheers Aleks



More information about the varnish-misc mailing list