Hi Paul, Sorry for the delayed response. I'm just getting back from holiday.
I think we'd need to see the *exact* CORS error message you are seeing and whether it has changed. You also might need to debug the exact requests that are being sent from your Browser to the REST API. This can be done using your web browser's "Developer Tools" (in Chrome or Firefox type "Ctrl + Shift + I"). In Developer Tools you should be able to watch each request be sent from the Angular UI to the backend REST API...and see what response is returned. Likely one of the following is happening: 1) The request to the REST API is using an unexpected URL which is NOT listed in "rest.cors.allowed-origins" (in which case, adding it should fix the problem) 2) Or, maybe your Proxy is somehow modifying the request and either removing or changing the "Access-Control-Allow-Origin" header which is set automatically by the REST API. If that's the case, you'd need to fix your Proxy settings (and I don't have any good advice on how to do that, but I'd be interested to learn what works...in case others find this same issue). I wish I had better suggestions here. Quite honestly, you are working in a new territory here. We have not tested installing DSpace 7 across two different origins with a proxy. So, we do not yet have formal installation guide here or formal advice. But, perhaps you can help us improve docs here if you can figure out the issue at hand. Tim ________________________________ From: [email protected] <[email protected]> on behalf of [email protected] <[email protected]> Sent: Wednesday, August 19, 2020 11:27 AM To: DSpace Technical Support <[email protected]> Subject: Re: [dspace-tech] dspace7 installation on remote server with apache Hi, I have removed the ssl from my apache config temporarily, in order to test if there was some problem with the encrypted data coming through to the unencrypted angular and tomcat server instances. The browser still reports CORS errors as before, and with numerous error messages saying the JSESSIONID is treated as a cross site cookie. This is with the suggestion from Tim of setting a list of 2 urls in the local.cfg under rest.cors.allow-origins. rest.cors.allowed-origins = ${dspace.ui.url}, http://repo7-test.amad.org<https://repo7-test.amad.org/> Note the http in the url, not https, since I removed the ssl Thanks and best regards, Paul On Tuesday, August 11, 2020 at 12:27:09 PM UTC+2 [email protected] wrote: Hi Tim, I got this error message in catalina.out: java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens I found this information on stackoverflow: https://stackoverflow.com/questions/42218237/java-lang-illegalargumentexception-invalid-character-found-in-method-name-http It indicates that the incoming information, which is encoded for tls/ssl, is not being read correctly by the java. Does that ring a bell for someone? Thanks! Paul On Monday, August 10, 2020 at 3:17:57 PM UTC+2, Paul Warner wrote: Hi Tim, Thanks for the info. I tried using the list for my rest.cors.allow-origins, but I am still getting the cors errors. rest.cors.allowed-origins = ${dspace.ui.url}, https://repo7-test.amad.org Is there anything else I can try? Where can I look to see where things are going wrong? Thanks again, Paul On Friday, August 7, 2020 at 8:33:48 PM UTC+2, Tim Donohue wrote: Hi Paul, You may want to leave your "dspace.ui.url" as it is, and directly override "rest.cors.allow-origins" in your local.cfg By default, "rest.cors.allow-origins" is ONLY the "dspace.ui.url" as noted here:https://github.com/DSpace/DSpace/blob/main/dspace/config/modules/rest.cfg#L10 However, you can provide it a *list* of URLs that you want the REST API to respond to. So, you could modify it to be something like: rest.cors.allowed-origins = ${dspace.ui.url}, http://127.0.0.1:8355, http://another.url, https://yetanother.url The list can include as many URLs as you want. The key is that it *MUST* include "dspace.ui.url" as one of those URLs. The other URLs can be whatever you want. Keep in mind that, as we are still in active development, not all of this is written down. But the expectation is that while *many sites* can leave the "rest.cors.allow-origins" at it's default setting...some sites (especially those using proxies or just wanting several URL to access their REST API for other needs) may need to modify it. Tim ________________________________ From: [email protected] <[email protected]> on behalf of Paul Warner <[email protected]> Sent: Thursday, August 6, 2020 11:27 PM To: DSpace Technical Support <[email protected]> Subject: Re: [dspace-tech] dspace7 installation on remote server with apache Hi Tim, The error is: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:8355/server/api/authn/status So it is the case that tomcat is refusing the connection. I have tomcat listening only on 127.0.0.1:8355<http://127.0.0.1:8355>. And Angular is listening at localhost:4000. The problem is, I am using apache as a proxy, so I have 3 addresses, these two, plus our domain name. Apache passes the requests to localhost:4000. I have tried plugging the domain name in for the dspace.ui.url. I get the same CORS error. How else can I present the app to the outside world? I do not think pointing the Angular server directly out on our domain name is a good idea, and I do not know how to set up ssh/tls for this server, anyway. How is one supposed to run this arrangement when one goes live? I just need to make this instance available for my team to test it. Best regards, and thanks for the help! Paul On Tuesday, August 4, 2020 at 4:38:02 PM UTC+2, Tim Donohue wrote: Hi Paul, Could you provide more info on the CORS errors? The reason I ask, is that I wonder what URL the backend thinks you are sending requests from. CORS errors should only occur if the URL sending requests (to the REST API) is *not* listed in the "rest.cors.allowed-origins" setting. So, that makes me suspect that the UI is sending requests under a URL that is *not* identical to what you set for "dspace.ui.url" in the backend. Generally speaking, the frontend configuration and backend configuration need to be identical, or you will hit problems. So, this means, in the Angular UI, the "ui" environment settings: https://github.com/DSpace/dspace-angular/blob/main/src/environments/environment.common.ts#L10-L16 need to *match* what you configure as "dspace.ui.url" on the backend. Similar, in the Angular UI, the "rest" environment settings: https://github.com/DSpace/dspace-angular/blob/main/src/environments/environment.common.ts#L20-L26 need to *match* what you configure as "dspace.server.url" on the backend. If the "ui" settings don't match, you are likely to end up with CORS errors, as the UI will be sending requests from a slightly different URL and the REST API will block those requests. This is my _best guess_ at what you might be seeing. Tim ________________________________ From: [email protected] <[email protected]> on behalf of Paul Warner <[email protected]> Sent: Tuesday, August 4, 2020 12:32 AM To: DSpace Technical Support <[email protected]> Subject: [dspace-tech] dspace7 installation on remote server with apache Hi, My team wants very much to test dspace 7, and I have an installation on a remote server that uses apache as the frontend proxy. I did this so I can offer the site to my team with ssl/tls. They cannot get to the command line on the server, and a command line browser (w3m) does not work with angular anyway. So they need a url that is external. I have set the rest.cors settings in local.cfg: rest.cors.allowed-origins = ${dspace.ui.url} and have set the dspace.ui.url to the url to apache. I am still getting cors errors in the browser (Firefox). There are no errors anywhere else in the logs. Is there a better way to set up dspace 7 so it is visible from a domain externally? Best regards, Paul -- 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/ee9bb9f8-117d-4113-a0d3-548861121d45o%40googlegroups.com<https://groups.google.com/d/msgid/dspace-tech/ee9bb9f8-117d-4113-a0d3-548861121d45o%40googlegroups.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/806ba430-b794-4490-9e5b-6371e7654819o%40googlegroups.com<https://groups.google.com/d/msgid/dspace-tech/806ba430-b794-4490-9e5b-6371e7654819o%40googlegroups.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]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/5fb220e2-e80d-4741-9bd4-2afc38df704en%40googlegroups.com<https://groups.google.com/d/msgid/dspace-tech/5fb220e2-e80d-4741-9bd4-2afc38df704en%40googlegroups.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/DM5PR2201MB11481BD7D17A3FE61ED2FD2BED5D0%40DM5PR2201MB1148.namprd22.prod.outlook.com.
