cors
Download
server {
	listen [::]:80 default_server;
	listen 80 default_server;
	server_name _;
	root /var/www/cors;

	location /{
		# Disable cache
		add_header 'Cache-Control' 'no-cache';

		# CORS setup
		add_header 'Access-Control-Allow-Origin' '*' always;
		add_header 'Access-Control-Expose-Headers' 'Content-Length';
		# allow CORS preflight requests
		if ($request_method = 'OPTIONS') {
			add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'Content-Length';
			add_header 'Access-Control-Max-Age' 1728000;
			add_header 'Content-Type' 'text/plain charset=UTF-8';
			add_header 'Content-Length' 0;
			return 204;
		}
		try_files $uri $uri/ /index.html =404;
	}
}
docker run --detach --name nginx-cors \
    --volume "${PWD}/cors.conf:/etc/nginx/conf.d/default.conf" \
    --volume "${PWD}/files:/var/www/cors" \
    --publish "8080:80" \
    --workdir "/var/www/cors" \
    nginx
curl -SsD- -X OPTIONS -D- http://localhost:8080/
docker stop nginx-cors
docker rm nginx-cors