andersnas / nodecat

A port of Akamais CAT implementation into NodeJS
Apache License 2.0
2 stars 3 forks source link

Edgeworker variables should be replaced with objects obtainable by Node #7

Open andersnas opened 23 hours ago

andersnas commented 23 hours ago

In cat.js we need to obtain the IP and ASN (ALPN) from local objects instead of Akamai variables:

validateCatnip const clientIp = request.getVariable("PMUSER_CLIENT_IP");

validateCatalpn const alpn = request.getVariable("PMUSER_ALPN"), alpnHex = base16.encode((new TextEncoder).encode(alpn));

andersnas commented 22 hours ago

A thought, as the nodecat code is likely running behind a proxy it may be worth adding the real connecting IP in a X-Forwarded-For header and the ASN (ALPN) in a X-Forwarded-For-ALPN header instead of using the built in req.socket.remoteAddress?

izenoni commented 21 hours ago

That sounds like a good idea. I know most of the time that might be the case.