tags:

views:

145

answers:

1

I know using referrer is a bad idea but I need a quick fix to lockdown content inside a folder on a tomcat application this is just the temp fix until we can get a long term one in place.

I would like to use the referrer header to block off site linking to one directory. I need to do this directly in Tomcat if possible.

Thanks for any help.

+1  A: 

The HTTP Referer header is spoofable, trivially, I might add. I would advise against this approach. A better (more secure) way to lock down access to a folder in your web application is to add a <security-constraint> in your WEB-INF/web.xml.

If you want to restrict by client IP address, you could use the Remote Address Filter Valve.

Asaph
Can the app still point to files with a standard url then? I have a web app which isn't correct or something I can change in the short term that simply links to the content which I need to make somewhat hidden if I could at least do referer header I thought it would help in the short term.
Jeff Beck
@Jeff Beck: It's security by obscurity. Anyone who wants to access it still can. All they have to do is know what referer to put in the header. If your user is authenticated, you can restrict by role. Will that work for you?
Asaph
@Jeff Beck: If you want to restrict by client IP address, you could use the Remote Address Filter Valve. I updated my answer to include this.
Asaph
The users are authenticated by the application but I can't make any changes to the app in the timeline that this needs to be starting to addressed. I will try the security-constraint and see how it is going.
Jeff Beck