Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request/Response not served from SailJS because of CORS issue #40

Open
swaroopjayanthi9 opened this issue May 13, 2017 · 0 comments
Open

Comments

@swaroopjayanthi9
Copy link

I am running Web REST API on Swagger, Sail JS, when I am trying to access through Angular UI,. I have set the required headers in the UI and as well as enabled in sailjs > config/cors.js file with below values.

allRoutes: true,
origin: '*',
credentials: true,

From the UI application, I am setting below headers before sending any request.
this.headers = new Headers({ 'Content-Type': 'application/json', 'Accept': 'q=0.8;application/json;q=0.9' });
this.headers.set('Access-Control-Allow-Origin' , '*');
this.headers.set('Access-Control-Allow-Methods', 'GET,POST,PUT,HEAD,DELETE,OPTIONS');
this.headers.set('Access-Control-Allow-Headers', 'origin, content-type, accept');
this.headers.append('Access-Control-Allow-Credentials', 'true');
this.headers.append('Access-Control-Max-Age' , '86400');

But I am not able to get the response from Sail JS, can you please let me know if I am missing anything or do I need enable any other settings on the SailJS config.

Please do the needful to resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant