I would like to serve a JS file by CDN, but I want to be able to control the sites/pages that are allowed to use it. (Using the CDN. I know people can still just copy the file if they wanted to.)
Is there a way to control what site/url can request the file? I only have found things like preventing hotlinking (= only allowing the main domain)
I guess the alternative would be just serving the file by CDN and having it send a request to some API and which will then check if it is allowed to use the file. This would cause me & them bandwidth and another request, which, if possible, would be great to keep low. I could serve the file by myself, but I am expecting high request numbers, so I thought a CDN would be better.