我正在尝试阻止所有非本地主机尝试访问 Webrick 进程。这是我当前的代码
def do_GET(req, res)
host_name = "localhost:3344".split(":")[0]
if host_name != "localhost" && host_name != "127.0.0.1"
puts "Security alert, accessing through #{host_name}"
return
else
puts "we're fine, #{host_name}"
end
# etc.
这容易破解吗?我的想法是主机名很难欺骗网络服务器本身。