I am developing an application in React js, which uses Axios to get or post data through Jira server REST API. The API requests are done just from the Front End as I don’t have a backend server.
I was getting CORS errors when doing the API requests, so I looked for solutions because I don’t have Jira Admin access on Jira server to whitelist the React application. Then, I found out the proxy option which needs to be added to the package.json file, something like this:
This worked good, however now that I wanted to do the deployment to Production it is not working and I discovered that the proxy attribute works just for Development.
So, my question is how to solve the problem on Production because as the proxy attribute does not work there, the application tries to do the Axios calls using the local server name and port instead of using the URL of my.jiraserver throwing an error and if I prepend the https://my.jiraserver.com to the URLs in Axios calls I get the CORS errors.