Hi everyone,
I’m running into an issue with my deployed Replit app that I’m hoping someone can help with.
The situation:
I have a REST API deployed on Replit. I want to call this API programmatically from another Replit project (also a deployed app). Both projects are mine.
The problem:
All external API requests are being blocked with errors like:
-
“Expected X-Requested-With header”
-
“Invalid referrer”
These errors are NOT coming from my application code. My Express server has CORS configured with origin: '*' and I have no referrer validation. The requests are being blocked before they reach my code.
What I’ve tried (with help from Replit Agent):
-
Added CORS middleware allowing all origins - didn’t help
-
Switched from Autoscale to Reserved VM deployment - same issue
-
Added browser-like headers (X-Requested-With, User-Agent, Referer) - didn’t help
-
Tried different Referer header values - didn’t help
The development URL works fine when the Repl is running. The issue only happens with the production deployment URL.
My questions:
-
Has anyone successfully set up a Replit deployment as a public API that accepts programmatic requests?
-
Is there a way to disable the bot/referrer protection on deployed apps?
-
Is there a specific configuration or header combination that works?
Any help would be greatly appreciated!