Securing a Cloudflare-Proxied a Server Against Unauthorized Frontend Requests
System Overview:
You have three components under your control:
Malicious users can:
Ensure the relay server only processes requests from your unmodified frontend code, while blocking requests from altered or unauthorized clients.
You have three components under your control:
- A relay server (public-facing, Cloudflare-proxied).
- A web server that dynamically generates frontend code (HTML/JS).
- A frontend that embeds JavaScript (from the web server) to fetch data from the relay server.
Malicious users can:
- Discover your relay server’s public domain.
- Tamper with the frontend’s embedded JavaScript (e.g., modifying API calls or parameters).
- Spam/abuse the relay server directly with unauthorized requests.
Ensure the relay server only processes requests from your unmodified frontend code, while blocking requests from altered or unauthorized clients.