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] <javascript:> <[email protected] 
> <javascript:>> on behalf of Paul Warner <[email protected] <javascript:>>
> *Sent:* Thursday, August 6, 2020 11:27 PM
> *To:* DSpace Technical Support <[email protected] <javascript:>>
> *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.  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] <javascript:>.
> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/7e2d0738-291a-4813-8aa7-8e9e43d26ab2o%40googlegroups.com.

Reply via email to