Quick help with the statistics api on Dspace 7.2

493 views
Skip to first unread message

Augusto Mendonça

unread,
Mar 16, 2022, 3:35:06 PM3/16/22
to DSpace Technical Support
Hello everyone!

We've been trying to setup a 7.2 version but I've looked on every config file on the back-end but couldnt locate where to change the base href of the base statistics server. 

Our call "http://<ip>/server/api/statistics" is always returning:

{ "id": null, "type": "statistics", "_links": { "searchevents": { "href": "http://127.0.0.1:8080/server/api/statistics/searchevents" }, "self": { "href": "http://127.0.0.1:8080/server/api/statistics" }, "viewevents": { "href": "http://127.0.0.1:8080/server/api/statistics/viewevents" } } }

But on the client side it just throws: "Failed to load resource: net::ERR_CONNECTION_REFUSED" -> http://127.0.0.1:8080/server/api/statistics/viewevents

Is there any way to change this "127.0.0.1" to my actual server ip? 

The documentation only mentions solr but the solr is fine. The file "/modules/usage-statistics.cfg" gave me some hope but it's not there. 

I also noticed that the discovery service calls (http://127.0.0.1:8080/server/api/discover/browses/author/entries) are also fixed on the wrong ip. 

Thanks in advance!

Tim Donohue

unread,
Mar 17, 2022, 10:29:14 AM3/17/22
to DSpace Technical Support
Hi,

Those URLs are from the "dspace.server.url" configuration in your local.cfg (or dspace.cfg).  It's likely you've set that to be "http://127.0.0.1:8080/server", which obviously is not the URL you want: https://github.com/DSpace/DSpace/blob/main/dspace/config/dspace.cfg#L26

If the UI is accessible to the world, you MUST ensure that this "dspace.server.url" is also accessible to the world...so, it cannot be a 127.0.0.1 or localhost URL unless you only plan to access the UI and REST API from localhost (i.e. this can be useful for development but is never used in production).

Tim

Augusto Mendonça

unread,
Mar 18, 2022, 9:05:50 AM3/18/22
to DSpace Technical Support
Hi Tim,

Thank you so much for replying. 

dspace.cfg is set correctly almost all services are pointing to the correct ip adress but two, both statistics and discovery that are going for http://127.0.0.1:8080/server 

And I couldnt find where to set those two, but if they all import from the same path "dspace.server.url" i, something is really wrong with our institute installation. Any ideas what I could change/check?

Thank you so much,

Tim Donohue

unread,
Mar 21, 2022, 10:15:09 AM3/21/22
to DSpace Technical Support
Hi,

Check the response of your DSpace 7 REST API... on the root path, there should be a property named "dspaceServer".  That URL is the value of "dspace.server.url" which is being "seen" by the REST API.  For example, on the demo REST API, "dspaceServer=https://api7.dspace.org/serverhttps://api7.dspace.org/server/

If that "dspaceServer" is set to "http://127.0.0.1:8080/server", then that means that your "dspace.server.url" is set to that value somewhere.  Check your dspace.cfg. Check your local.cfg.   If they look correct, reboot Tomcat (maybe an old value was cached).

If that "dspaceServer" is set correctly, then maybe you are running some sort of Proxy that is getting things mixed up?  Maybe requests to your REST API are proxied to http://127.0.0.1:8080?  If so, it's possible that your Proxy is replacing the URL and needs to set one of the X-Forwarded-* headers?   You also could check to see if the default value of "server.forward-headers-strategy" (from Spring Boot) is set correctly based on your Proxy setup.  More on that config at: https://wiki.lyrasis.org/display/DSDOC7x/Configuration+Reference#ConfigurationReference-ProxySettings

Essentially, this sounds like either a basic configuration issue or possibly a proxy issue.

Tim

Sovello

unread,
Jun 30, 2023, 7:22:17 AM6/30/23
to DSpace Technical Support

I am going to add here though this is an old issue but am facing a similar issue.
So, after upgrading from 6.x to 7.5 something strange shows up.
All the _links {} point to 127.0.0.1 and the handle in "dc.identifier.uri": [{ "value": "}] point to the remote IP Address.
This is both when load the page from the ui or from the HAL browser or even hitting the REST API directly.
What could be the issue here?

Thanks in advance
Reply all
Reply to author
Forward
0 new messages