Skip to content

Instantly share code, notes, and snippets.

@toamitkumar
Last active March 29, 2018 08:04
Show Gist options
  • Save toamitkumar/814dbfc9969597a4553dc9d3a6c876c7 to your computer and use it in GitHub Desktop.
Save toamitkumar/814dbfc9969597a4553dc9d3a6c876c7 to your computer and use it in GitHub Desktop.
nginx config
location ~ /api/v1/cards/(\w+)/(\w+) {
if ($request_method = OPTIONS ) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Cache-Control,Content-Type,If-Modified-Since';
return 204;
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Cache-Control,Content-Type,If-Modified-Since';
add_header 'Access-Control-Allow-Headers' 'Content-Type,If-Modified-Since';
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
add_header 'Content-type' 'application/json';
default_type application/json;
try_files $uri.json
}
location ~ /api/v1/cards/(\w+)/(\w+)\,(\w+) {
if ($request_method = OPTIONS ) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Cache-Control,Content-Type,If-Modified-Since';
return 204;
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Cache-Control,Content-Type,If-Modified-Since';
add_header 'Access-Control-Allow-Headers' 'Content-Type,If-Modified-Since';
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
add_header 'Content-type' 'application/json';
default_type application/json;
try_files /usr/share/nginx/html/telkomsel_d8/sites/default/files/assets/cards/$1/$2_$3.json;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment