Skip to content

Instantly share code, notes, and snippets.

@Ben754444
Created September 5, 2024 19:53
Show Gist options
  • Select an option

  • Save Ben754444/279858f5fb404baa1606d7afa81259b7 to your computer and use it in GitHub Desktop.

Select an option

Save Ben754444/279858f5fb404baa1606d7afa81259b7 to your computer and use it in GitHub Desktop.
// src/template/worker.js
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url)
const forward = decodeURIComponent(request.url.split("monitoring-proxy?ddforward=")[1])
const res = await fetch(`https://browser-intake-us5-datadoghq.com/${forward}`, {
method: "POST",
headers: {
"User-Agent": request.headers.get("user-agent"),
"X-Forwarded-For": request.headers.get("cf-connecting-ip"),
"Content-Type": request.headers.get("content-type")
},
body: request.body
})
return res
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment