Skip to content

Commit aeade2a

Browse files
committed
add logging
1 parent d79ac95 commit aeade2a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ app.put('/deploy', async (c) => {
6060
return c.text('Invalid filename', 400)
6161
}
6262

63+
const forwardedFor = c.req.header('x-forwarded-for')
64+
const realIp = c.req.header('x-real-ip') ?? c.req.header("cf-connecting-ip")
65+
const remoteAddress = (c.req.raw as { socket?: { remoteAddress?: string } }).socket?.remoteAddress
66+
const remoteHost = forwardedFor || realIp || remoteAddress || 'unknown'
67+
console.log(`Accepted ${filename} from ${remoteHost}`)
68+
6369
const location = config.locations[token]
6470
try {
6571
const targetPath = await resolveTargetPath(location, filename)

0 commit comments

Comments
 (0)