Proxy integrations
Before you start
Read Proxy setup first. Every example below does the same thing: it forwards each path under /collect/ on your host to https://api., with the method, body and headers unchanged. Then pass your host as the SDK's endpoint.
Cloudflare Workers
Create a Worker with the code below and add a route for app.example.com/ on your zone.
// Route app.example.com/collect/* to this Worker.export default { async fetch(request) { const url = new URL(request.url); const upstream = new URL(url.pathname + url.search, "https://api.lrdefender.lightningresearch.ai"); // Same method, headers (Origin and Authorization included) and body. return fetch(new Request(upstream, request)); },};Vercel
An external rewrite in vercel.json forwards the path from any Vercel project.
{ "rewrites": [ { "source": "/collect/:path*", "destination": "https://api.lrdefender.lightningresearch.ai/collect/:path*" } ]}Next.js
On a Next.js app you host yourself, the same rewrite goes in next..
import type { NextConfig } from "next"; const nextConfig: NextConfig = { async rewrites() { return [ { source: "/collect/:path*", destination: "https://api.lrdefender.lightningresearch.ai/collect/:path*" }, ]; },}; export default nextConfig;Netlify
A rewrite with status 200 in _redirects proxies the path instead of redirecting the browser.
/collect/* https://api.lrdefender.lightningresearch.ai/collect/:splat 200Amazon CloudFront
- Add an origin for
api.lrdefender., over HTTPS only.lightningresearch.ai - Add a behavior for the path pattern
/collect/*that uses this origin and allows every HTTP method. - Give it the managed cache policy
CachingDisabledand the managed origin request policyAllViewerExceptHostHeader, so the Origin and Authorization headers reach us unchanged.