Skip to content
Snippets Groups Projects
Select Git revision
  • master default
1 result

nginx.conf

Blame
  • nginx.conf 1.52 KiB
     server {
            listen 80;
            server_name  _;
    
     
    
            root   /usr/share/nginx/html;
            index  index.html index.htm;
            include /etc/nginx/mime.types;
    
     
    
            gzip on;
            gzip_min_length 1000;
            gzip_proxied expired no-cache no-store private auth;
            gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    
     
    
            location / {
                try_files $uri $uri/ /index.html;
                
                add_header 'Access-Control-Allow-Origin' '*';
                add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';
                
                if ($request_method = 'OPTIONS') {
                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';
                    #
                    # Custom headers and headers various browsers *should* be OK with but aren't
                    #
                    add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
                    #
                    # Tell client that this pre-flight info is valid for 20 days
                    #
                    return 204;
                }
            if ($request_method = 'DELETE') {
                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Allow-Methods' 'DELETE'; 
                }
            }
        }