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?)