Software /
code /
prosody
Diff
plugins/mod_http.lua @ 11409:d30c44a829c1
net.http.server: Set request.ip so mod_http doesn't have to
Because it already sets request.secure, which depends on the connection,
just like the IP, so it makes sense to do both in the same place.
Dealing with proxies can be left to mod_http for now, but maybe it could
move into some util some day?
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 27 Feb 2021 21:37:16 +0100 |
parent | 11408:1b6298e7b550 |
child | 11410:2ea70d291429 |
line wrap: on
line diff
--- a/plugins/mod_http.lua Sat Feb 27 21:07:36 2021 +0100 +++ b/plugins/mod_http.lua Sat Feb 27 21:37:16 2021 +0100 @@ -260,7 +260,7 @@ end local function get_ip_from_request(request) - local ip = request.conn:ip(); + local ip = request.ip; local forwarded_for = request.headers.x_forwarded_for; if forwarded_for and is_trusted_proxy(ip) then -- luacheck: ignore 631