Project

General

Profile

CORS problem

Added by abir bn almost 6 years ago

Hello , I m using redmine api 3.4.6 ( bitnami sack ) , and i m trying to get the list of projects using an angular 6 app, but get this error : "failed to load http://localhost:8080/redmine/projects.json: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 404" ,
i searched on the internet for the redmine plugin cors but it is not compatible for my redmine version , any ideas?


Replies (1)

RE: CORS problem - Added by Ken Zalewski almost 6 years ago

Hi abir,

Are you running Redmine behind an Apache server with Passenger? If so, you can add some HTTP header configuration lines to your Apache config that will set the appropriate CORS headers.

I used the following lines in order to get the JavaScript/Angular request to succeed:
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS"
Header always set Access-Control-Allow-Headers "*"

Let me know if that helps.

    (1-1/1)