AtlasOfLivingAustralia / biocache-service

Occurrence & mapping webservices
https://biocache-ws.ala.org.au/ws/
Other
9 stars 26 forks source link

fixed request.getHeader("X-Forwarded-For") returns multiple ip addres… #675

Closed alexhuang091 closed 3 years ago

alexhuang091 commented 3 years ago

…ses.

For https://github.com/AtlasOfLivingAustralia/biocache-service/issues/575

According to https://github.com/AtlasOfLivingAustralia/logger-service/blob/bce9dfecbd29504b2a98e4fd3dc45107ed4c9de7/grails-app/controllers/au/org/ala/logger/IpAddressInterceptor.groovy#L20

and https://serverfault.com/questions/846489/can-x-forwarded-for-contain-multiple-ips

request.getHeader(X_FORWARDED_FOR) could return a list of ip addresses separated by ,. We just need to extract the first one which is the original client ip address.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.01%) to 41.759% when pulling bbdc34e3ae592181797a00c61a6a123abcd180eb on issue_575_2_ip_addresses into 159350f8bef062eea8be9e5af09352779cce526b on develop.