On Fri, Jul 1, 2011 at 7:13 PM, Jonathan Hursey <
[email protected]> wrote:

> if you're just doing it for one:
>
> set req.http.host = regsub(req.http.host, "10.10.0.2", "www.domname.de");
>
> if you want a universal catch all on that I'm not too sure. Sounds like
> you'd need to resolve the name. or mod_modrewrite on the backend.
>
>
> On Fri, Jul 1, 2011 at 7:05 AM, David Theis 
> <[email protected]>wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi everybody,
>>
>> i'm getting right to my question:
>> if a user contacts one of our proxy servers using only the ip address
>> i'd like to rewrite this ip address into a domain name, so that the user
>> sees www.domainname.de instead of e.g 10.0.0.2 in his/her browser
>> address bar. is this possible with varnishd ?
>>
>> We're using freebsd-7.4-RELEASE + varnish 2.1.5 !
>>
>> mfg
>> David
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v2.0.17 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAk4NuA0ACgkQu/Z5Qo6690XlYACgj2or4DFsYSxMiAUPoTRjr9y0
>> xWQAoJSW112qam6BUixSZjwEibsLMLY0
>> =hw0m
>> -----END PGP SIGNATURE-----
>>
>> _______________________________________________
>> varnish-misc mailing list
>> [email protected]
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>
>
>
> --
> *Jonathan M. Hursey*
> *Linux Systems Administrator*
>
>
To catch all IP addresses, use...

 if (req.http.host ~
"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
 { error 750 "http://www.domain.com";; }


sub vcl_error {
    if (obj.status == 750) {
        set obj.http.Location = obj.response req.url;
        set obj.status = 301;
        return(deliver);
    }
}
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to