nginx.conf 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # keep in sync with clsi-startup.sh files
  2. # keep in sync with server-ce/nginx/clsi-nginx.conf
  3. # Changes to the above:
  4. # - added debug header
  5. server {
  6. # Extra header for dev-env.
  7. add_header 'X-Served-By' 'clsi-nginx' always;
  8. listen 8080;
  9. server_name clsi-proxy;
  10. server_tokens off;
  11. access_log off;
  12. # Ignore symlinks possibly created by users
  13. disable_symlinks on;
  14. # enable compression for tex auxiliary files, but not for pdf files
  15. gzip on;
  16. gzip_types text/plain;
  17. gzip_proxied any;
  18. types {
  19. text/plain log blg aux stdout stderr;
  20. application/pdf pdf;
  21. }
  22. # handle output files for specific users
  23. location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/build/([0-9a-f-]+)/output/output\.([a-z]+)$ {
  24. if ($request_method = 'OPTIONS') {
  25. # handle OPTIONS method for CORS requests
  26. add_header 'Allow' 'GET,HEAD';
  27. return 204;
  28. }
  29. alias /output/$1-$2/generated-files/$3/output.$4;
  30. }
  31. # handle output files for anonymous users
  32. location ~ ^/project/([0-9a-f]+)/build/([0-9a-f-]+)/output/output\.([a-z]+)$ {
  33. if ($request_method = 'OPTIONS') {
  34. # handle OPTIONS method for CORS requests
  35. add_header 'Content-Type' 'text/plain charset=UTF-8';
  36. add_header 'Allow' 'GET,HEAD';
  37. return 200 'GET,HEAD';
  38. }
  39. alias /output/$1/generated-files/$2/output.$3;
  40. }
  41. # PDF range for specific users
  42. location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/content/([0-9a-f-]+/[0-9a-f]+)$ {
  43. if ($request_method = 'OPTIONS') {
  44. # handle OPTIONS method for CORS requests
  45. add_header 'Content-Type' 'text/plain charset=UTF-8';
  46. add_header 'Allow' 'GET,HEAD';
  47. return 200 'GET,HEAD';
  48. }
  49. # Cache for one day
  50. expires 1d;
  51. alias /output/$1-$2/content/$3;
  52. }
  53. # PDF range for anonymous users
  54. location ~ ^/project/([0-9a-f]+)/content/([0-9a-f-]+/[0-9a-f]+)$ {
  55. if ($request_method = 'OPTIONS') {
  56. # handle OPTIONS method for CORS requests
  57. add_header 'Content-Type' 'text/plain charset=UTF-8';
  58. add_header 'Allow' 'GET,HEAD';
  59. return 200 'GET,HEAD';
  60. }
  61. # Cache for one day
  62. expires 1d;
  63. alias /output/$1/content/$2;
  64. }
  65. # status endpoint for haproxy httpchk option
  66. location /status {
  67. return 200;
  68. }
  69. # load shedding probe
  70. location = /instance-state {
  71. alias /var/clsi/instance-state;
  72. }
  73. }