axiom-data-science / docker-erddap

A feature full Tomcat (SSL over APR, etc.) running ERDDAP
16 stars 26 forks source link

fix ip address in logs when running reverse proxy #76

Closed callumrollo closed 3 months ago

callumrollo commented 3 months ago

When running a reverse proxy in front of ERDDAP (e.g. nginx, load balancer etc.) the ip address recorded in the tomcat log files is an the internal proxy ip address, not the ip address of the client.

This PR adds requestAttributesEnabled="true" to AccessLogValve in server.xml after it is copied from the unidata tomcat image.

I don't think this should break anything, but definitely want to test this one out before merging. I have not previously worked with reverse proxies and request headers.

Solution first posted in the ERDDAP google group https://groups.google.com/g/erddap/c/8UUUSwavsvA/m/23-ClxdbAgAJ

srstsavage commented 3 months ago

Thanks for contributing this. Can you move the modification to update-server-xml.sh using set_attribute? Or ping me and I can do so :grin: