DSpace 7.2: CORS errors and HTTP 500 code when setting up REST-API and UI on seperate machines

771 views
Skip to first unread message

Mathias Gutenbrunner

unread,
Apr 6, 2022, 8:02:58 AM4/6/22
to DSpace Technical Support

Hello everyone,

I am trying to set up the following scenario with DSpace 7.2:

1.) I want do set up an all-in-one virtual-machine-server which hosts
the REST-API and a UI, which I will call ds7aio.example.edu in this mail
(that worked)

2.)I want to set up a second virtual-machine-server which only hosts a
second UI, which I will call ds7ui.example.edu in this mail (that
doesn't work for yet, and I get an HTTP 500 error code)

Part (1) worked with the following parameters in the local.cfg:

dspace.server.url = https://ds7aio.example.edu/server
dspace.ui.url = https://ds7aio.example.edu

and a config.prod.yml with the following content for the UI:

ui:
  ssl: false
  host: localhost
  port: 4000
  nameSpace: /
rest:
  ssl: true
  host: ds7aio.example.edu
  port: 443
  nameSpace: /server

For part (2) I used the same config.prod.yml file on ds7ui.example.edu

and changed the parameter dspace.ui.url in te local.cfg on
ds7aio.example.edu to:

dspace.ui.url = https://ds7aio.example.edu, https://ds7ui.example.edu

I also added the following parameter:

rest.cors.allowed-origins = https://ds7aio.example.edu,
http://localhost, http://localhost:4000, http://localhost:8080/server,
https://ds7aio.example.edu/server, https://ds7ui.example.edu

when I try to retrieve ds7ui.example.edu I the DSpace UI redirects to a
HTTP 500 Page.
Also there are lots of CORS-errors shown in the browser-console.

Does anyone have experience with that kind of errors?
Did anyone solve it and successfully set up REST-API and UI on seperate
machines with DSpace 7.2 or another version of DSpace 7?

Thank you very much for your help in advance!

Greetings,
Mathias

--
Mathias Gutenbrunner
Philipps-Universität Marburg
Universitätsbibliothek
Abteilung Digitale Dienste
Sachgebiet Forschungsnahe E-Dienstleistungen

Tim Donohue

unread,
Apr 6, 2022, 9:48:27 AM4/6/22
to DSpace Technical Support, Mathias Gutenbrunner
Hi Mathias,

At this time, I'm not sure that it's possible to run a single REST API with multiple DSpace 7 UIs.  So, the setting "dspace.ui.url" can only be one value​ (and cannot be multi-valued).  This is likely the root issue you are experiencing.

The backend currently makes assumptions that there is only one, primary DSpace 7 UI that it is communicating with.  I'm not sure that it'd be possible to change that easily, as in some cases the backend needs to send links to the UI or redirect you to the UI, and in those cases it must know the URL of the DSpace 7 UI.

If you wanted to try this route, my best advice would be to choose one UI to be the primary one.  Set that in "dspace.ui.url".  Then add the secondary UI only​ to "rest.cors.allowed-origins".  I'm not sure how well this would work though, as it has never been tested.  And, you'd have to keep in mind that the backend would only send emails and links which go back to the primary UI, and never to to the secondary UI.

Tim

From: 'Mathias Gutenbrunner' via DSpace Technical Support <dspac...@googlegroups.com>
Sent: Wednesday, April 6, 2022 3:15 AM
To: DSpace Technical Support <dspac...@googlegroups.com>
Subject: [dspace-tech] DSpace 7.2: CORS errors and HTTP 500 code when setting up REST-API and UI on seperate machines
 
--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/46eb59d4-f1e9-58b4-0687-7e8c2360eec7%40ub.uni-marburg.de.
Reply all
Reply to author
Forward
0 new messages