Welcome! Log In Create A New Profile

Advanced

Allow all Access-Control-Allow-Headers

May 20, 2015 04:42AM
Hi,

I have a nginx in front of many differrents web applications. At this time a have a generic configuration for all applications.
Now I need to allow all Access-Control-Allow-Headers but I did not find how to do this.

One of the web application behind my nginx reverse proxy set custom headers. At this time i create a specific nginx configuration file for this application with configuration :

if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'traceId,channel,callerId,version,type';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}

But I don't like this solution because I need to have a generic configuration for all web applications behind the nginx.

Is it possible to allow all "Access-Control-Allow-Headers" for all request ?

Thanks for your reply.

Regards.
Subject Author Posted

Allow all Access-Control-Allow-Headers

cyrille May 20, 2015 04:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 133
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready