Skip to content

Instantly share code, notes, and snippets.

@nisbus
Created February 10, 2013 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nisbus/4750795 to your computer and use it in GitHub Desktop.
Save nisbus/4750795 to your computer and use it in GitHub Desktop.
server {
server_name couchdb.nisbus.com www.couchdb.nisbus.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:5984;
proxy_redirect default;
proxy_set_header Host $host:$proxy_port;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
access_log /var/log/nginx/localhost.access.log;
include conf.d/drop;
}
@nisbus
Copy link
Author

nisbus commented Feb 10, 2013

server {
server_name nisbus.com www.nisbus.com;

access_log /var/log/nginx/nisbus.com.access.log;

access_log /var/log/nginx/localhost.access.log;

include conf.d/drop;
location / {
     proxy_pass http://127.0.0.1:5984/nisbus_com/_design/nisbus.com/index.html;
     proxy_redirect default;
}

}

@nisbus
Copy link
Author

nisbus commented Feb 10, 2013

location = /favicon.ico {access_log off; log_not_found off;}
location = /robots.txt {access_log off; log_not_found off;}

location ~ /. {deny all; access_log off; log_not_found off;}

@omarkj
Copy link

omarkj commented Feb 10, 2013

if ($request_method = 'OPTIONS') {
  add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  add_header 'Access-Control-Allow-Origin' '*';
  add_header 'Access-Control-Allow-Credentials' 'true';
  add_header 'Access-Control-Allow-Headers' 'Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type';
  add_header 'Access-Control-Max-Age' 1728000;
  add_header 'Content-Type' 'text/plain charset=UTF-8';
  add_header 'Content-Length' 0;
  return 204;
}

@nisbus
Copy link
Author

nisbus commented Feb 10, 2013

server {
server_name couchdb.nisbus.com www.couchdb.nisbus.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:5984;
proxy_redirect default;
proxy_set_header Host $host:$proxy_port;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';

add_header 'Access-Control-Allow-Credentials' 'true';

    add_header 'Access-Control-Allow-Headers' 'Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type';
    if ($request_method = 'OPTIONS') {
       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
       add_header 'Access-Control-Allow-Origin' '*';

add_header 'Access-Control-Allow-Credentials' 'true';

       add_header 'Access-Control-Allow-Headers' 'Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type';
       add_header 'Access-Control-Max-Age' 1728000;
       add_header 'Content-Type' 'text/plain charset=UTF-8';
       add_header 'Content-Length' 0;

       return 204;
    }
}
access_log /var/log/nginx/localhost.access.log;
include conf.d/drop;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment