7002 Se habilitó "useProxies" para registrar descargas en Google Analytics #110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Se registran las descargas a partir de la última IP, que no sea la de un proxy conocido, a paritir de las IPs que vienen en el X-Forwarded-For.
El código agregado esta basado en DSpace 6. Hay un comentario para borrar ese código cuando se migre.
Para probar, uno puedo ejecutar
curl --output tmp.pdf --header "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1" --header "X-Forwarded-For: 172.19.0.5, 163.10.34.147" -v http://localhost:9090/bitstream/handle/10915/33046/.pdf?sequence=4&isAllowed=y&aux=o
Previamente habría que agregar la IP de uno a dspace.cfg en "proxies.trusted.ipranges", como si uno fuese el proxy que hace la petición a DSpace.
Verificar tambien que el pdf exista (en el ejemplo que pase es justamente un ejemplo)
Para el ejemplo anterior, la IP que se deberia agregar en el evento de GA en https://github.com/sedici/DSpace/blob/e6904c644c402620fdc848f6da499c545b3fd2d6/dspace-api/src/main/java/org/dspace/google/GoogleRecorderEventListener.java#L88 deberia ser "172.19.0.5"