mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-24 14:35:49 +00:00
enh: add requestId to locals
This commit is contained in:
parent
0a2ab02fad
commit
0bd29824d2
@ -53,6 +53,7 @@ export const proxyService = mkSingleton(async (config: ProxyServiceConfig) => {
|
|||||||
// Default locals
|
// Default locals
|
||||||
server.use((req, res, next) => {
|
server.use((req, res, next) => {
|
||||||
const host = req.headers.host
|
const host = req.headers.host
|
||||||
|
res.locals.requestId = seqid()
|
||||||
res.locals.host = host
|
res.locals.host = host
|
||||||
res.locals.coreInternalUrl = coreInternalUrl
|
res.locals.coreInternalUrl = coreInternalUrl
|
||||||
next()
|
next()
|
||||||
@ -65,7 +66,7 @@ export const proxyService = mkSingleton(async (config: ProxyServiceConfig) => {
|
|||||||
const ip = (req.headers['x-forwarded-for'] as string) || '<ip>'
|
const ip = (req.headers['x-forwarded-for'] as string) || '<ip>'
|
||||||
const method = req.method || '<m>'
|
const method = req.method || '<m>'
|
||||||
const sig = [
|
const sig = [
|
||||||
seqid(),
|
res.locals.requestId,
|
||||||
method.padStart(10),
|
method.padStart(10),
|
||||||
country.padStart(5),
|
country.padStart(5),
|
||||||
ip.padEnd(45),
|
ip.padEnd(45),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user