AngularJS app on Node fails to reach the JIRA API because of CORS. Example:
myAngular.service('apiCaller', function($http) {
return $http.get('http://127.0.0.1:4001/api/status');
});
AngularJS app on Node fails to reach the JIRA API because of CORS. Example:
myAngular.service('apiCaller', function($http) {
return $http.get('http://127.0.0.1:4001/api/status');
});
I encountered a similar problem when trying to access an external REST API using AngularJS on a Node backend. After a fair amount of troubleshooting, I realized that the error was clearly due to CORS restrictions imposed by the web browser. In my case, I fixed it by including the appropriate headers on the Node server side, such as Access-Control-Allow-Origin, and ensuring that all relevant methods were permitted. This approach allowed my Angular application to device the necessary data without any issues. The key was ensuring full communication between the two ends and not only focusing on client-side adjustments.
I encountered a similar issue in the past while trying to integrate an external API into an AngularJS application running on Node. In my case, the problem was not solely due to client-side restrictions but because the server settings were not correctly forwarding CORS headers. What eventually worked for me was establishing a reverse proxy layer on the server to relay API requests. This proxy ensured the Angular app communicates with the Node server locally, which in turn interacts with the JIRA API, appending the necessary CORS headers in the process.