frigjord
frigjord2y ago

How to get remote IP address when using Deno.serve?

I'm using connInfo when using Deno from STD but the native http server doesn't seem to have such interface, since it's undefined via the handler.
3 Replies
crowlKats
crowlKats2y ago
currently not possible
crowlKats
crowlKats2y ago
GitHub
feat(flash): add 2nd param to handler to get remote address by crow...
Closes #17583 Not a big fan of it being a function, but couldnt think of a better solution without potential performance regressions
frigjord
frigjord17mo ago
Thanks for making such a PR; I hope someone can approve it soon deno as a proxy is useless without this The PR has been implemented now and can be accessed like this:
async function handler (request, connInfo) {
console.log(connInfo.remoteAddr.hostname)
}
async function handler (request, connInfo) {
console.log(connInfo.remoteAddr.hostname)
}