Add debug messages

This commit is contained in:
Hri7566 2024-02-01 12:40:29 -05:00
parent 7d83cbd485
commit c7784642a7
1 changed files with 4 additions and 1 deletions

View File

@ -37,11 +37,14 @@ export const app = Bun.serve<{ ip: string }>({
fetch: (req, server) => {
const reqip = server.requestIP(req);
if (!reqip) return;
logger.debug("x-forwarded-for:", req.headers.get("x-forwarded-for"));
logger.debug("requestIP:", reqip);
const ip = req.headers.get("x-forwarded-for") || reqip.address;
if (
server.upgrade(req, {
data: {
ip: req.headers.get("x-forwarded-for") || reqip.address
ip
}
})
) {