Token-handler now uses HTTP headers to know the true origin IP address.

This commit is contained in:
Philippe Pittoli 2024-03-14 23:19:15 +01:00
parent 76244e6fe7
commit 611765d45d

View File

@ -13,13 +13,8 @@ dnsmanagerd = DNSManager::Client.new
#dnsmanagerd.login login, pass #dnsmanagerd.login login, pass
server = HTTP::Server.new do |context| server = HTTP::Server.new do |context|
pp! context.request.remote_address pp! context.request.headers["Host"]
ip = case remote = context.request.remote_address ip = context.request.headers["Host"] rescue next
when Socket::IPAddress
remote.address
else
""
end
case context.request.path case context.request.path
when /^\/token-update\/(?<token>[a-z0-9-]+)/ when /^\/token-update\/(?<token>[a-z0-9-]+)/