Limit file types that can be proxied

reference123 nginx-forum at
Thu May 27 22:19:57 MSD 2010

I am trying to limit the file types that can be proxied from our backend server.  I am trying to limit it to jpg, gif, png, css and then two other specific files  - Thumbnail.ashx and hearbeat.htm.  I am also hoping to limit access to only certain referers.

I have tried this code which works fine for the jpg, gif, png, css but is not working for the heartbeat.htm file.  It gives a 404 on all .htm files including heartbeat.htm.

location ~* (\.jpg|\.png|\.gif|\.css|ThumbNail\.ashx|heartbeat\.htm)$ {

		if ($invalid_referer) {
			return 404;

		proxy_pass	http://exampleimages_com;

Any help would be appreciated.

Posted at Nginx Forum:,91106,91106#msg-91106

More information about the nginx mailing list