I created a LoggerJSON.PlugUtils module to match the LoggerJSON.FormatterUtils module. I then moved the get_header/2 function into it, and moved the common (same in all plug formatters) remote_ip/1 function in it as well.
I updated the remote_ip/1 function to only return the client IP address if it was sent through a proxy. According to MDN and our System76 logs, this header can return a list of IP addresses. Datadog and Google Cloud Logger both document this field as a simple string, not a list of them.
Let me know if this module change is too much and I can undo it. As well as any changes you need. 🎊
Coverage increased (+0.9%) to 74.667% when pulling fc6cfe08c978ab89c9aa79b3e1d0f1884776d867 on btkostner:fix-forwarded-ip-header into c2512dee7880b6cecccc17093eff9e243077fba7 on Nebo15:master.
I created a
LoggerJSON.PlugUtils
module to match theLoggerJSON.FormatterUtils
module. I then moved theget_header/2
function into it, and moved the common (same in all plug formatters)remote_ip/1
function in it as well.I updated the
remote_ip/1
function to only return the client IP address if it was sent through a proxy. According to MDN and our System76 logs, this header can return a list of IP addresses. Datadog and Google Cloud Logger both document this field as a simple string, not a list of them.Let me know if this module change is too much and I can undo it. As well as any changes you need. 🎊