Skip to content

Follow on to the request to get caller IP.. Also need the server name #1262

Answered by garypen
golfingal72 asked this question in Q&A
Discussion options

You must be logged in to vote

It's possible to get the HOST header from an originating_request member. You can also retrieve the host member from the originating_request URI details. e.g.:

self.originating_request.headers().get("HOST") 
self.originating_request.uri().host()

This will report the data that the client has provided (which may be an IP address or a DNS resolvable name or ...). There is no service within the router to perform a DNS lookup, so if the host details weren't in the form you required, you would have to provide that capability to your plugin.

I can't recommend a rust DNS lib, but there seem to be a selection to choose from.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@golfingal72
Comment options

@calvinl
Comment options

@garypen
Comment options

@calvinl
Comment options

Answer selected by golfingal72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants