Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.54 KB | None | 0 0
  1. proxy_cache_path /var/snap/subutai/common/cache/nginx/templ/ levels=1:2 keys_zone=TEM:10m inactive=1w max_size=20g;
  2. proxy_cache_path /var/snap/subutai/common/cache/nginx/deb/ levels=1:2 keys_zone=APT:10m inactive=1w max_size=10g;
  3. proxy_cache_path /var/snap/subutai/common/cache/nginx/raw/ levels=1:2 keys_zone=RAW:10m inactive=1w max_size=10g;
  4. proxy_cache_path /var/snap/subutai/common/cache/nginx/qry/ levels=1:2 keys_zone=QRY:10m inactive=1w max_size=1g;
  5. proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
  6. proxy_cache_lock on;
  7. proxy_cache_lock_age 20m;
  8. proxy_cache_lock_timeout 20m;
  9. proxy_connect_timeout 10;
  10. proxy_send_timeout 1200;
  11. proxy_read_timeout 1200;
  12. send_timeout 1200;
  13. proxy_cache_revalidate on;
  14. proxy_request_buffering off;
  15.  
  16. server {
  17. listen 80;
  18. server_name <cdn domain>;
  19.  
  20. return 301 https://$host:8338$request_uri;
  21. }
  22.  
  23. server {
  24. listen 8338;
  25. server_name <cdn domain>;
  26. client_max_body_size 2G;
  27. proxy_connect_timeout 6000;
  28. proxy_send_timeout 6000;
  29. proxy_read_timeout 6000;
  30. send_timeout 6000;
  31.  
  32. ssl on;
  33. ssl_certificate <public certificate>;
  34. ssl_certificate_key <certificate private key>;
  35.  
  36. error_page 497 https://$host$request_uri;
  37.  
  38. location ~ /kurjun/rest/template/(get|download) {
  39. proxy_pass https://eu0.<cdn domain>:8338$request_uri;
  40. proxy_cache TEM;
  41. proxy_cache_valid 1m;
  42. proxy_ignore_headers "Cache-Control" "Expires";
  43. }
  44.  
  45. location /kurjun/rest/apt/(get|download) {
  46. proxy_pass https://eu0.<cdn domain>:8338$request_uri;
  47. proxy_cache APT;
  48. proxy_cache_valid 1m;
  49. proxy_ignore_headers "Cache-Control" "Expires";
  50. }
  51.  
  52. location ~ /kurjun/rest/raw/(get|download) {
  53. proxy_pass https://eu0.<cdn domain>:8338$request_uri;
  54. proxy_cache RAW;
  55. proxy_cache_valid 1m;
  56. proxy_ignore_headers "Cache-Control" "Expires";
  57. }
  58.  
  59. location /kurjun/rest/auth {
  60. proxy_pass https://eu0.<cdn domain>:8338$request_uri;
  61. }
  62.  
  63. location /kurjun/rest/auth/validate {
  64. if ($http_origin ~* (https?://[^/]*\.subut\.ai|https://subutai.io)) {
  65. set $cors "true";
  66. add_header 'Access-Control-Allow-Origin' "$http_origin";
  67. }
  68. if ($request_method = 'OPTIONS') {
  69. set $cors "${cors}options";
  70. }
  71. if ($request_method = 'GET') {
  72. set $cors "${cors}get";
  73. }
  74. if ($request_method = 'POST') {
  75. set $cors "${cors}post";
  76. }
  77.  
  78. if ($cors = "true") {
  79. add_header 'Access-Control-Allow-Origin' "$http_origin";
  80. }
  81.  
  82. if ($cors = "trueget") {
  83. add_header 'Access-Control-Allow-Origin' "$http_origin";
  84. add_header 'Access-Control-Allow-Credentials' 'true';
  85. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  86. add_header 'Access-Control-Allow-Headers' 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  87. }
  88.  
  89. if ($cors = "trueoptions") {
  90. add_header 'Access-Control-Allow-Origin' "$http_origin";
  91. add_header 'Access-Control-Allow-Credentials' 'true';
  92. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  93. add_header 'Access-Control-Allow-Headers' 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  94. add_header 'Access-Control-Max-Age' 1728000;
  95. add_header 'Content-Type' 'text/plain charset=UTF-8';
  96. add_header 'Content-Length' 0;
  97. return 204;
  98. }
  99.  
  100. if ($cors = "truepost") {
  101. add_header 'Access-Control-Allow-Origin' "$http_origin";
  102. add_header 'Access-Control-Allow-Credentials' 'true';
  103. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  104. add_header 'Access-Control-Allow-Headers' 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  105.  
  106. }
  107. proxy_pass https://eu0.<cdn domain>:8338/kurjun/rest/auth/validate;
  108. proxy_cache QRY;
  109. proxy_cache_valid 1m;
  110. proxy_ignore_headers "Cache-Control" "Expires";
  111. }
  112.  
  113. location /kurjun {
  114. if ($http_origin ~* (https?://[^/]*\.subut\.ai|https://subutai.io)) {
  115. set $cors "true";
  116. add_header 'Access-Control-Allow-Origin' "$http_origin";
  117. }
  118. if ($request_method = 'OPTIONS') {
  119. set $cors "${cors}options";
  120. }
  121. if ($request_method = 'GET') {
  122. set $cors "${cors}get";
  123. }
  124. if ($request_method = 'POST') {
  125. set $cors "${cors}post";
  126. }
  127.  
  128. if ($cors = "true") {
  129. add_header 'Access-Control-Allow-Origin' "$http_origin";
  130. }
  131.  
  132. if ($cors = "trueget") {
  133. add_header 'Access-Control-Allow-Origin' "$http_origin";
  134. add_header 'Access-Control-Allow-Credentials' 'true';
  135. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  136. add_header 'Access-Control-Allow-Headers' 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  137. }
  138.  
  139. if ($cors = "trueoptions") {
  140. add_header 'Access-Control-Allow-Origin' "$http_origin";
  141. add_header 'Access-Control-Allow-Credentials' 'true';
  142. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  143. add_header 'Access-Control-Allow-Headers' 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  144. add_header 'Access-Control-Max-Age' 1728000;
  145. add_header 'Content-Type' 'text/plain charset=UTF-8';
  146. add_header 'Content-Length' 0;
  147. return 204;
  148. }
  149.  
  150. if ($cors = "truepost") {
  151. add_header 'Access-Control-Allow-Origin' "$http_origin";
  152. add_header 'Access-Control-Allow-Credentials' 'true';
  153. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  154. add_header 'Access-Control-Allow-Headers' 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  155.  
  156. }
  157. proxy_pass https://eu0.<cdn domain>:8338/kurjun;
  158. proxy_cache QRY;
  159. proxy_cache_valid 1m;
  160. proxy_ignore_headers "Cache-Control" "Expires";
  161. }
  162. }
  163.  
  164. server {
  165. listen 8080;
  166. server_name <cdn domain>;
  167. client_max_body_size 2G;
  168. location /kurjun/rest/apt {
  169. proxy_pass https://eu0.<cdn domain>:8338$request_uri;
  170. proxy_cache APT;
  171. proxy_cache_valid 1m;
  172. proxy_ignore_headers "Cache-Control" "Expires";
  173. }
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement