SuNbiT
SuNbiT

Reputation: 85

Response status 201 not accepted in CORS requests

I'm setting up an app with some REST webservices, that respond with 200 or 201 according to the result of the request.

On the other hand, i'm developing a javascript web application that has to use this webservices, so i'm dealing with CORS in the server-side with nginx adding the proper headers to the response.

The problem as i can tell, is that when the service responds with 201, cors headers don't reach the client. The first thought was that it was a problem/restriction on browsers, but then i realized that nginx was not adding the cors headers in any response with 201 status code.

The nginx config i'm using is available at https://github.com/UPCnet/maxserver/blob/master/production/nginx.conf

Any clue? Please ask if you need any other information/details

Thanks!

Upvotes: 3

Views: 2127

Answers (1)

SuNbiT
SuNbiT

Reputation: 85

nginx directive add_headers only work for a short list of status code, in which 201 it's not in..

Adding the headers_module and using it instead, allows to add custom headers to responses with 201 status

Upvotes: 2

Related Questions