github.com/qubitproducts/logspray@v0.2.14/server/swagger-ui/nginx.conf (about)

     1  worker_processes      1;
     2  
     3  events {
     4    worker_connections  1024;
     5  }
     6  
     7  http {
     8    include             mime.types;
     9    default_type        application/octet-stream;
    10  
    11    sendfile on;
    12  
    13    keepalive_timeout   65;
    14  
    15    server {
    16      listen            8080;
    17      server_name       localhost;
    18  
    19      location / {
    20        root            /usr/share/nginx/html;
    21        index           index.html index.htm;
    22        if ($request_method = 'OPTIONS') {
    23            add_header 'Access-Control-Allow-Origin' '*';
    24            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    25            #
    26            # Custom headers and headers various browsers *should* be OK with but aren't
    27            #
    28            add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
    29            #
    30            # Tell client that this pre-flight info is valid for 20 days
    31            #
    32            add_header 'Access-Control-Max-Age' 1728000;
    33            add_header 'Content-Type' 'text/plain charset=UTF-8';
    34            add_header 'Content-Length' 0;
    35            return 204;
    36        }
    37        if ($request_method = 'POST') {
    38            add_header 'Access-Control-Allow-Origin' '*';
    39            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    40            add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
    41        }
    42        if ($request_method = 'GET') {
    43            add_header 'Access-Control-Allow-Origin' '*';
    44            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    45            add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
    46        }
    47      }
    48    }
    49  }