Block requests via intermediate host names at nginx -


i have setup users supposed send requests a.com. requests sent cdn further sends request a-reader.com, , a-reader routes request nginx.

i want a-reader accessible via cdn, so, aim block request original request url not a.com. if user types a-reader.com/<anything> in browser address bar, requests should blocked @ nginx

is possible?

yes - can use nginx http referrer module - http://nginx.org/en/docs/http/ngx_http_referer_module.html

in case, since want allow a.com, configuration should like:

valid_referers *.a.com; if ($invalid_referer) {     return 403; } 

you'll have customize valid referral list match domain.


alternatively, can regex matching on $http_referer:

 if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|poker|porn))     {  return 403;   } 

(http referer https://calomel.org/nginx.html via how block referral spam using nginx?)


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -