Skip to content

Conversation

@sebastian-zm
Copy link

@sebastian-zm sebastian-zm commented Jan 30, 2026

Add referrerPolicy: 'no-referrer' to browser fetch calls to prevent Hugging Face infrastructure from blocking requests based on referrer.

To test: curl https://huggingface.co/Xenova/bert-base-uncased/resolve/main/config.json
And also: curl -s https://huggingface.co/Xenova/bert-base-uncased/resolve/main/config.json -H "Referer: https://workers.dev/"
And also: curl -s https://huggingface.co/Xenova/bert-base-uncased/resolve/main/config.json -H "Referer: https://example.com/"

Weird stuff happens when adding a referer from a workers.dev subdomain.

See live example at https://transformers-js-demo.cloudflare-huddle586.workers.dev/ where the model errors. However, see example at https://transformers-js-demo-2.cloudflare-huddle586.workers.dev/ using my fork of transformers.js where it actually works with my changes.

Add referrerPolicy: 'no-referrer' to browser fetch calls to prevent
Hugging Face infrastructure from blocking requests based on referrer.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@sebastian-zm
Copy link
Author

I created a discussion to see if the block can be fixed at https://discuss.huggingface.co/t/cannot-access-from-workers-dev-subdomains/172959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant