mirror of
https://github.com/YuzuZensai/Test-IP.git
synced 2026-07-21 15:19:28 +00:00
Send header back to client
This commit is contained in:
@@ -3,7 +3,15 @@ const app = express();
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
const ip = req.headers["x-forwarded-for"] || req.socket.remoteAddress;
|
||||
res.send(ip);
|
||||
|
||||
let data = "";
|
||||
data = `IP Address: ${ip}`;
|
||||
|
||||
for (let key in req.headers) {
|
||||
data += `${key}: ${req.headers[key]}`;
|
||||
data += "<br/>";
|
||||
}
|
||||
res.send(data);
|
||||
res.end();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user