forked from seth/ipv4.army
Add API endpoint to return request headers as a gzipped JSON response
This commit is contained in:
parent
424343e311
commit
cf21a56d7a
1 changed files with 9 additions and 0 deletions
9
index.ts
9
index.ts
|
@ -155,6 +155,15 @@ const webserver = serve({
|
||||||
const request = new Request(req);
|
const request = new Request(req);
|
||||||
request.headers.delete('cookie');
|
request.headers.delete('cookie');
|
||||||
return await fetch("https://plausible.creations.works/api/event", request);
|
return await fetch("https://plausible.creations.works/api/event", request);
|
||||||
|
},
|
||||||
|
"/api/headers": async (req) => {
|
||||||
|
return new Response(gzipSync(JSON.stringify({ headers: req.headers })), {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Content-Encoding": "gzip",
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
websocket: {
|
websocket: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue