To make our on-prem One Time Secret service to work properly, without expiritng urls I implemented the following on the nginx daemon to filter out link previews request. Guess the same could be done on any HTTP service.
server {
if ($http_user_agent !~* Gecko ) {
return 404 ;
}
Gecko here stands for the browser as most of the link crawlers are using unique name such as SkypeUriPreview or TwitterBot.
More agents could be finded here:
https://developers.whatismybrowser.com/useragents/explore/software_type_specific/web-browser
For examle if you want only the Chrome browser use this:
if ($http_user_agent !~ Chrome ) {
return 444;
}
More info how to use rewrite module could be finded here:
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return