All,
I have a jenkins project that has an nginx frontend working correctly. Now I am trying to use valid_refers to block hotlink access to one particular area . I can get this to partially work but not fully, i.e. I can block access to the directory or display the image on my website.
Here is my config in hopes that some one can help.
upstream hudson {
server 127.0.0.1:8081;
}
server {
listen ci.test.com:80;
server_name ci.test.com;
# location /job {
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto http;
# proxy_set_header Host $http_host;
# proxy_next_upstream error;
# proxy_pass http://hudson;
# }
location / {
rewrite ^ https://ci.test.com$request_uri? permanent;
}
}
server {
listen ci.test.com:443;
server_name ci.test.com;
ssl on;
ssl_certificate /etc/ssl/certs/star_test_com.crt;
ssl_certificate_key /etc/ssl/private/star_test_com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_next_upstream error;
proxy_pass http://hudson;
proxy_redirect http://ci.test.com/ https://ci.test.com/;
}
location ~ /src/ {
valid_referers none blocked *.test.com;
if ($invalid_referer) {
return 403;
}
}
}
Additional information
nginx 0.7.67-3ubuntu1
ubuntu maverick (10.10)
Thanks for looking.