2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 {%- import_yaml "ssl_key_encrypted.sls" as ssl_key_encrypted_pillar %}
16 upstream webshell_upstream:
17 - server: 'shell.__DOMAIN__:4200 fail_timeout=10s'
22 arvados_webshell_default.conf:
27 - server_name: webshell.__DOMAIN__
31 - return: '301 https://$host$request_uri'
33 arvados_webshell_ssl.conf:
40 - server_name: webshell.__DOMAIN__
42 - __WEBSHELL_EXT_SSL_PORT__ http2 ssl
43 - index: index.html index.htm
44 - location /shell.__DOMAIN__:
45 - proxy_pass: 'http://webshell_upstream'
46 - proxy_read_timeout: 90
47 - proxy_connect_timeout: 90
48 - proxy_set_header: 'Host $http_host'
49 - proxy_set_header: 'X-Real-IP $remote_addr'
50 - proxy_set_header: X-Forwarded-Proto https
51 - proxy_set_header: 'X-Forwarded-For $proxy_add_x_forwarded_for'
52 - proxy_ssl_session_reuse: 'off'
54 - "if ($request_method = 'OPTIONS')":
55 - add_header: "'Access-Control-Allow-Origin' '*'"
56 - add_header: "'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'"
57 - add_header: "'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'"
58 - add_header: "'Access-Control-Max-Age' 1728000"
59 - add_header: "'Content-Type' 'text/plain charset=UTF-8'"
60 - add_header: "'Content-Length' 0"
63 - "if ($request_method = 'POST')":
64 - add_header: "'Access-Control-Allow-Origin' '*'"
65 - add_header: "'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'"
66 - add_header: "'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'"
68 - "if ($request_method = 'GET')":
69 - add_header: "'Access-Control-Allow-Origin' '*'"
70 - add_header: "'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'"
71 - add_header: "'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'"
73 - include: snippets/ssl_hardening_default.conf
74 - ssl_certificate: __CERT_PEM__
75 - ssl_certificate_key: __CERT_KEY__
76 {%- if ssl_key_encrypted_pillar.ssl_key_encrypted.enabled %}
77 - ssl_password_file: {{ '/run/arvados/' | path_join(ssl_key_encrypted_pillar.ssl_key_encrypted.privkey_password_filename) }}
79 - access_log: /var/log/nginx/webshell.__DOMAIN__.access.log combined
80 - error_log: /var/log/nginx/webshell.__DOMAIN__.error.log