You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

50 regels
1.7 KiB

  1. worker_processes 1;
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include mime.types;
  7. default_type application/octet-stream;
  8. sendfile on;
  9. keepalive_timeout 65;
  10. server {
  11. listen 8080;
  12. server_name localhost;
  13. location / {
  14. root /usr/share/nginx/html;
  15. index index.html index.htm;
  16. if ($request_method = 'OPTIONS') {
  17. add_header 'Access-Control-Allow-Origin' '*';
  18. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  19. #
  20. # Custom headers and headers various browsers *should* be OK with but aren't
  21. #
  22. add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  23. #
  24. # Tell client that this pre-flight info is valid for 20 days
  25. #
  26. add_header 'Access-Control-Max-Age' 1728000;
  27. add_header 'Content-Type' 'text/plain charset=UTF-8';
  28. add_header 'Content-Length' 0;
  29. return 204;
  30. }
  31. if ($request_method = 'POST') {
  32. add_header 'Access-Control-Allow-Origin' '*';
  33. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  34. add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  35. }
  36. if ($request_method = 'GET') {
  37. add_header 'Access-Control-Allow-Origin' '*';
  38. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  39. add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  40. }
  41. }
  42. }
  43. }