Hi All,

Apologies for all this confusion and chaos.

I just don't want my website to be accessible by using the IP address on
which the website is hosted. Even if the Users use the IP address, I want
them to be redirected to my website.

It is the same way as www.facebook .com is hosted at "173.252.110.27".
When a user types "173.252.110.27" in the URL he is redirected to
"www.facebook.com"

I want to have the same functionality for mywebsite also.

To have this functionality I was trying Varnish to redirect the Users to
www.mywebsite.com .

Thanks
Puneet

-----Original Message-----
From: Poul-Henning Kamp [mailto:[email protected]] 
Sent: Sunday, July 28, 2013 3:12 AM
To: Puneet
Cc: [email protected]
Subject: Re: Stop users accessing website via IP address

In message <[email protected]>, Puneet writes:

>I want to stop the users accessing my website via IP address.
>I am using varnish as cache.
>I have the following code in place but it is not working.
>
>In vcl_recv() {
>     if(req.url ~ "XX.XX.XXX.XXX") {

You should check the req.http.host header, that's where you will find the
IP# or hostname the user used.


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[email protected]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to