Created
September 5, 2024 19:53
-
-
Save Ben754444/279858f5fb404baa1606d7afa81259b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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