Multiple CORS header ‘Access-Control-Allow-Origin’ not allowed Error

Hi

I am trying to connect a React App with the Remote Instance, but I am getting Multiple CORS header ‘Access-Control-Allow-Origin’ not allowed Error.

The http://localhost:3000 is already whitelisted.

These are the headers that I am getting twice in a single request.
image

Any help is much appreciated.
Thanks

Hi @sami12111

Thank you for your question. Do you see any errors in the Catalina.out log? If yes, please share the complete log (without sensitive info).

Additionally, please check the web.xml file in Tomcat, it should only contain one origin and not multiple. Remove any additional origin and keep only one origin then restart Tomcat.

Please let us know how it goes. Thanks!

Hi @Gassim

How can I check if the web.xml in tomcat contains multiple origins?
I have this filter for http, which is commented in web.xml file

Thanks

Hi @sami12111

Sorry the tip wasn’t helpful, it seems that the configuration in web.xml is not the issue. Other than this, we need to check if there are any additional errors in the Catalina.out log? Please share the complete Catalina.out log (without authentication/sensitive info).

Additionally, please share as much information about the instance as possible. What version of dhis2 are you using?

Thanks!

@sami12111 most likely you are using a reverse proxy such as NGINX or Apache which is inserting an additional CORS header. You should remove this configuration from the intermediate proxy or ensure that you remove the one coming from DHIS2 if this is the intended behavior. You can configure the CORS whitelist in the System Settings application in DHIS2.

1 Like