Bill, As of Beta3, the backend (REST API) has an "allow list" of frontend(s) that it responds to. This setting corresponds to the value(s) of the "Access-Control-Allow-Origin" header which will be automatically set by the backend webapp...and setting "Access-Control-Allow-Origin" to an asterisk (wildcard) is _no longer supported_. These settings are for security purposes.
See this config in the rest.cfg: https://github.com/DSpace/DSpace/blob/master/dspace/config/modules/rest.cfg#L10 It existed prior to beta3, but was officially enabled as part of beta3 (it didn't work properly in beta2). My suspicion is this is the issue you are hitting. Chances are you need to change this setting's value (or the default value in dspace.ui.url) in your local.cfg. Tim ________________________________ From: 'Bill Tantzen' via DSpace Technical Support <[email protected]> Sent: Friday, July 10, 2020 2:58 PM To: DSpace Technical Support <[email protected]> Subject: [dspace-tech] Re: problems with dspace-angular-beta3 Hi all! A little followup information regarding my problems getting dspace-angular-beta03 up and running. The client works if it is installed and running on my localhost:4000 against the test api at dspace7.4science.cloud. Running the client on localhost on any other port, or against my own server results in the preflight/cors errors described below. It all means that nobody but me can see the latest version (it seems that nobody wants to come to my house anymore...). Sorry this is long, so thanks in advance for reading through!! Closer examination shows that the 403 Errors I am catching are preflight requests from the browser. My attempts at a fix include setting the Access-Control-Allow-Origin="*" both in apache and in tomcat. Neither of which helped. What is strange is that the preflight seems to be a result of a simple GET request, which I think should not trigger such a request, but I'm a little out of my depth with this. Here is the complete request info (from Chrome in this case): * General * Request URL: https://udc-prd.lib.umn.edu/server/api/authn/status * Request Method: OPTIONS * Status Code: 403 403 * Remote Address: 128.101.65.121:443<http://128.101.65.121:443> * Referrer Policy: no-referrer-when-downgrade * Response Headersview source * Cache-Control: no-cache, no-store, max-age=0, must-revalidate * Connection: Keep-Alive * Date: Fri, 10 Jul 2020 13:39:00 GMT * Expires: 0 * Keep-Alive: timeout=5, max=100 * Pragma: no-cache * Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips mod_jk/1.2.48 * Strict-Transport-Security: max-age=31536000 ; includeSubDomains * Transfer-Encoding: chunked * Vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers * X-Content-Type-Options: nosniff * X-Frame-Options: DENY * X-XSS-Protection: 1; mode=block * Request Headersview source * Accept: */* * Accept-Encoding: gzip, deflate, br * Accept-Language: en-US,en;q=0.9 * Access-Control-Request-Headers: content-type * Access-Control-Request-Method: GET * Connection: keep-alive * Host: udc-prd.lib.umn.edu<http://udc-prd.lib.umn.edu> * Origin: https://udc-dev.lib.umn.edu:3000 * Referer: https://udc-dev.lib.umn.edu:3000/ * Sec-Fetch-Dest: empty * Sec-Fetch-Mode: cors * Sec-Fetch-Site: same-site * User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 and a snippet from the javascript console for the same request: Access to XMLHttpRequest at 'https://udc-prd.lib.umn.edu/server/api/authn/status' from origin 'https://udc-dev.lib.umn.edu:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. zone.js.pre-build-optimizer.js:3372 GET https://udc-prd.lib.umn.edu/server/api/authn/status net::ERR_FAILED And this is the result in my apache logs: 10.21.37.74 - - [10/Jul/2020:08:39:00 -0500] "OPTIONS /server/api/authn/status HTTP/1.1" 403 20 With an identical log entry on the tomcat side: 10.21.37.74 - - [10/Jul/2020:08:39:00 -0500] "OPTIONS /server/api/authn/status HTTP/1.1" 403 20 On Thu, Jul 9, 2020 at 7:08 AM Bill Tantzen <[email protected]<mailto:[email protected]>> wrote: Sorry for cross posting, but autocomplete tricked me into posting this on dspace-devel... Anyway Out of the box, my angular client works fine against the test REST server. However, when I run the client against my own REST server, every OPTIONS request generates a response code 403. (which usually results in the client hanging). I think this is a problem with either my tomcat or my apache setup, but I have not been able to track down the cause. (it's probably tomcat, because the response is initially returned there). In terms of configuration, both are pretty vanilla. One interesting side note: any identical request sent via Postman succeeds with response code 200! A problem with headers perhaps? I have apache version: Apache/2.4.6 (Red Hat Enterprise Linux), tomcat version 9.0.34 openjdk 11.07 Example errors from the java console: [Error] XMLHttpRequest cannot load https://XXXX.lib.umn.edu/server/api/statistics/viewevents<https://xxxx.lib.umn.edu/server/api/statistics/viewevents> due to access control checks. [Log] Error: – t (main.07d9b2d02aa94962fe83.js, line 1) t [Error] Object [Error] Failed to load resource: Preflight response is not successful (viewevents, line 0) And this is repeated for each and every OPTIONS request. Any ideas? Thanks, Bill -- Human wheels spin round and round While the clock keeps the pace... -- John Mellencamp ________________________________________________________________ Bill Tantzen University of Minnesota Libraries 612-626-9949 (U of M) 612-325-1777 (cell) -- Human wheels spin round and round While the clock keeps the pace... -- John Mellencamp ________________________________________________________________ Bill Tantzen University of Minnesota Libraries 612-626-9949 (U of M) 612-325-1777 (cell) -- All messages to this mailing list should adhere to the DuraSpace Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/ --- 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 [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/CADgrb7F3xcY1ggAx%3DHe_U--h1Mgbe%2BzV9Y94utkmmq7oujREhA%40mail.gmail.com<https://groups.google.com/d/msgid/dspace-tech/CADgrb7F3xcY1ggAx%3DHe_U--h1Mgbe%2BzV9Y94utkmmq7oujREhA%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- All messages to this mailing list should adhere to the DuraSpace Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/ --- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/DM5PR2201MB1148A91D082D6BB2582F95F5ED600%40DM5PR2201MB1148.namprd22.prod.outlook.com.
