Skip to content

Instantly share code, notes, and snippets.

@rhfung
rhfung / nginx-cors.conf
Last active Jan 8, 2019 — forked from algal/nginx-cors.conf
nginx configuration for CORS (Cross-Origin Resource Sharing), with an origin whitelist, and HTTP Basic Access authentication allowed
View nginx-cors.conf
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
# - Access-Control-Max-Age=20days, to minimize repetitive OPTIONS requests
View index.html
<!DOCTYPE html>
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<html>
<head>
<title></title>
<link href="http://www.techsfo.com/js/dc.js/v1.4.0/dc.css" rel='stylesheet' type="text/css">
</head>
<body>
<div id="monthly-move-chart"></div>
<div id="monthly-volume-chart"></div>