Commit 9a5cf651 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Implement type:notebook

parent a6f6696f
...@@ -91,7 +91,7 @@ md5sum = 69d65e461cd7cd5ef5b1ccd0098b50c8 ...@@ -91,7 +91,7 @@ md5sum = 69d65e461cd7cd5ef5b1ccd0098b50c8
[template-nginx-notebook-slave-virtualhost] [template-nginx-notebook-slave-virtualhost]
filename = templates/nginx-notebook-slave.conf.in filename = templates/nginx-notebook-slave.conf.in
md5sum = 548af159669069102ab9a1aae7b7dc25 md5sum = 753e87647d1ed4655432393bba062d3f
[template-apache-lazy-script-call] [template-apache-lazy-script-call]
filename = templates/apache-lazy-script-call.sh.in filename = templates/apache-lazy-script-call.sh.in
......
...@@ -3,102 +3,55 @@ ...@@ -3,102 +3,55 @@
{% if url.startswith("http://") or url.startswith("https://") %} {% if url.startswith("http://") or url.startswith("https://") %}
{% set upstream = url.split("/")[2] %} {% set upstream = url.split("/")[2] %}
{% set https_upstream = https_url.split("/")[2] %} {% set https_upstream = https_url.split("/")[2] %}
{% set protocol = url.split("/")[0] %}
{% set https_protocol = https_url.split("/")[0] %}
{% set proxy_pass = '%s//%s' % (protocol, slave_parameter.get('slave_reference')) %}
{% set https_proxy_pass = '%s//https_%s' % (protocol, slave_parameter.get('slave_reference')) %}
{% set ssl_configuration_list = [('ssl_certificate', 'path_to_ssl_crt'),
('ssl_certificate_key', 'path_to_ssl_key')] %}
https://{{ slave_parameter.get('custom_domain') }}:{{ nginx_https_port }} {
bind {{ local_ipv4 }}
log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
errors {{ slave_parameter.get('error_log') }}
# TODO-Caddy upstream {{ slave_parameter.get('slave_reference') }} { tls {{ slave_parameter.get('path_to_ssl_crt', slave_parameter.get('login_certificate')) }} {{ slave_parameter.get('path_to_ssl_key', slave_parameter.get('login_key')) }} {
# TODO-Caddy server {{ upstream }}; {% if slave_parameter.get('path_to_ssl_ca_crt') %}
# TODO-Caddy } clients {{ slave_parameter.get('path_to_ssl_ca_crt') }}
# TODO-Caddy upstream https_{{ slave_parameter.get('slave_reference') }} {
# TODO-Caddy server {{ https_upstream }};
# TODO-Caddy }
# TODO-Caddy server {
# TODO-Caddy listen {{ local_ipv4 }}:{{ nginx_http_port }};
# TODO-Caddy
# TODO-Caddy server_name {{ slave_parameter.get('custom_domain') }};
# TODO-Caddy
# TODO-Caddy error_log {{ slave_parameter.get('error_log') }} error;
# TODO-Caddy access_log {{ slave_parameter.get('access_log') }} custom;
# TODO-Caddy
# TODO-Caddy location / {
# TODO-Caddy proxy_pass {{ proxy_pass }};
# TODO-Caddy proxy_set_header Host $host;
# TODO-Caddy }
# TODO-Caddy
# TODO-Caddy location ~ /api/kernels/ {
# TODO-Caddy proxy_pass {{ proxy_pass }};
# TODO-Caddy proxy_set_header Host $host;
# TODO-Caddy # websocket support
# TODO-Caddy proxy_http_version 1.1;
# TODO-Caddy proxy_set_header Upgrade "websocket";
# TODO-Caddy proxy_set_header Connection "Upgrade";
# TODO-Caddy proxy_read_timeout 86400;
# TODO-Caddy }
# TODO-Caddy
# TODO-Caddy location ~ /terminals/ {
# TODO-Caddy proxy_pass {{ proxy_pass }};
# TODO-Caddy proxy_set_header Host $host;
# TODO-Caddy # websocket support
# TODO-Caddy proxy_http_version 1.1;
# TODO-Caddy proxy_set_header Upgrade "websocket";
# TODO-Caddy proxy_set_header Connection "Upgrade";
# TODO-Caddy proxy_read_timeout 86400;
# TODO-Caddy }
# TODO-Caddy }
# TODO-Caddy server {
# TODO-Caddy listen {{ local_ipv4 }}:{{ nginx_https_port }} ssl;
# TODO-Caddy
# TODO-Caddy server_name {{ slave_parameter.get('custom_domain') }};
# TODO-Caddy
# TODO-Caddy error_log {{ slave_parameter.get('error_log') }} error;
# TODO-Caddy access_log {{ slave_parameter.get('access_log') }} custom;
# TODO-Caddy
# TODO-Caddy ssl on;
# TODO-Caddy
# TODO-Caddy ssl_session_timeout 5m;
# TODO-Caddy ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# TODO-Caddy ssl_ciphers 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:HIGH:!aNULL:!MD5';
# TODO-Caddy ssl_prefer_server_ciphers on;
# TODO-Caddy ssl_session_cache shared:SSL:10m;
{% for key, value in ssl_configuration_list %}
{% if value in slave_parameter %}
# TODO-Caddy {{ ' %s' % key }} {{ slave_parameter.get(value) }};
{% endif %} {% endif %}
{% endfor %} alpn http/1.1
}
# TODO-Caddy location / {
# TODO-Caddy proxy_pass {{ https_proxy_pass }}; proxy / {{ https_upstream }} {
# TODO-Caddy proxy_set_header Host $host; transparent
# TODO-Caddy } insecure_skip_verify
# TODO-Caddy }
# TODO-Caddy location ~ /api/kernels/ { rewrite {
# TODO-Caddy proxy_pass {{ https_proxy_pass }}; regexp "/(api/kernels/[^/]+/(channels|iopub|shell|stdin)|terminals/websocket)/?"
# TODO-Caddy proxy_set_header Host $host; to /proxy/{1}
# TODO-Caddy # websocket support }
# TODO-Caddy proxy_http_version 1.1; proxy /proxy/ {{ https_upstream }} {
# TODO-Caddy proxy_set_header Upgrade "websocket"; header_upstream X-Real-IP {remote}
# TODO-Caddy proxy_set_header Connection "Upgrade"; header_upstream Host {host}
# TODO-Caddy proxy_read_timeout 86400; websocket
# TODO-Caddy } without /proxy/
# TODO-Caddy insecure_skip_verify
# TODO-Caddy location ~ /terminals/ { }
# TODO-Caddy proxy_pass {{ https_proxy_pass }}; }
# TODO-Caddy proxy_set_header Host $host;
# TODO-Caddy # websocket support http://{{ slave_parameter.get('custom_domain') }}:{{ nginx_http_port }} {
# TODO-Caddy proxy_http_version 1.1; bind {{ local_ipv4 }}
# TODO-Caddy proxy_set_header Upgrade "websocket"; log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
# TODO-Caddy proxy_set_header Connection "Upgrade"; errors {{ slave_parameter.get('error_log') }}
# TODO-Caddy proxy_read_timeout 86400;
# TODO-Caddy } proxy / {{ upstream }} {
# TODO-Caddy } transparent
insecure_skip_verify
}
rewrite {
regexp "/(api/kernels/[^/]+/(channels|iopub|shell|stdin)|terminals/websocket)/?"
to /proxy/{1}
}
proxy /proxy/ {{ upstream }} {
header_upstream X-Real-IP {remote}
header_upstream Host {host}
websocket
without /proxy/
insecure_skip_verify
}
}
{% endif %} {% endif %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment