Forum Discussion
reldar_76465
Sep 14, 2011Nimbostratus
Allowing access by referrer
Hi,
I have a client who wants to exclusively connect to a web site we created for them. we agreed to do this by identifying the referrer they are coming to our site with.
As they are coming from an https site, I added SSL to our site as well so I can capture the referrer (linking from https to http drops the referrer).
I setup the following rule for this:
when HTTP_REQUEST {
switch -glob [HTTP::path] {
"*/handlers/*" { }
default {
switch -glob [HTTP::header "Referer"] {
"https://www.example.com/*" {
HTTP::redirect "https://www.oursite.com"
}
"www.oursite.com/*" { }
"" { HTTP::respond 403 content "" }
}
}
}
}
the first part with the /handlers/ in the path is because our site is loading itself to load a component in it, this is how I solved this part.
I need a redirect because I want the address to change when going to our site.
this iRule is installed on the virtual server of the https site.
The problem: the redirect is going into a loop. any ideas?
Thanks.
- Michael_YatesNimbostratusHi reldar,
- reldar_76465NimbostratusOK, so it's getting more complicated.
- hooleylistCirrostratusIt's a bad security practice to depend on the Referer header to verify whether a request should allowed to a web app. The referer header (and all other HTTP headers) can easily be spoofed by a malicious client. It would be much more secure to use some authentication mechanism to enforce access control. Or worst case, lock access down by source IP address.
- reldar_76465Nimbostratus
yes, that;s true and I'm aware of this, but this is how the client wants to do this.
also, the IP option is not feasable as the site referring to me is open from everywhere to everyone, so there is no one IP or a group of IP's I can allow.
does someone have an idea where i can find an example of how to add a cookie to a session, and how to allow access by a cookie?
many thanks for the help.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects