Commit 0cde3291 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Implement type:zope

%2F%2F is used to avoid double slashes cleanup with Caddy. See
https://github.com/mholt/caddy/issues/1298, which touches the problem,
but not enough for zope.
parent 3f1bbc7a
...@@ -55,7 +55,7 @@ md5sum = 4dbb8560e4de1af2a0706b020e713fe7 ...@@ -55,7 +55,7 @@ md5sum = 4dbb8560e4de1af2a0706b020e713fe7
[template-default-slave-virtualhost] [template-default-slave-virtualhost]
filename = templates/default-virtualhost.conf.in filename = templates/default-virtualhost.conf.in
md5sum = 41f2c8bc8972f777becbf1cb588276ac md5sum = 95df69224d6f6554a674f5e3efebaa8f
[template-cached-slave-virtualhost] [template-cached-slave-virtualhost]
filename = templates/cached-virtualhost.conf.in filename = templates/cached-virtualhost.conf.in
......
...@@ -46,9 +46,7 @@ ...@@ -46,9 +46,7 @@
{% endif -%} {% endif -%}
# TODO-Caddy # Rewrite part # TODO-Caddy # Rewrite part
# TODO-Caddy ProxyPreserveHost On
# TODO-Caddy ProxyTimeout 600 # TODO-Caddy ProxyTimeout 600
# TODO-Caddy RewriteEngine On
{% if disable_via_header %} {% if disable_via_header %}
# TODO-Caddy Header unset Via # TODO-Caddy Header unset Via
...@@ -68,13 +66,19 @@ ...@@ -68,13 +66,19 @@
{% endif %} {% endif %}
{% if slave_type == 'zope' -%} {% if slave_type == 'zope' -%}
proxy / {{ slave_parameter.get('https-url', slave_parameter.get('url', '')) }} {
transparent
}
{% if 'default-path' in slave_parameter %} {% if 'default-path' in slave_parameter %}
# TODO-Caddy RewriteRule ^/?$ {{ slave_parameter.get('default-path') }} [R=301,L] redir 301 {
if {path} is /
/ {scheme}://{host}/{{ slave_parameter.get('default-path') }}
}
{% endif -%} {% endif -%}
# First, we check if we have a zope backend server rewrite {
# If so, let's use Virtual Host Monster rewrite regexp (.*)
# We suppose that Apache listens to 443 (even indirectly thanks to things like iptables) to /VirtualHostBase/{scheme}%2F%2F{hostonly}:{{ slave_parameter.get('virtualhostroot-https-port', '443') }}%2F{{ slave_parameter.get('path', '') }}%2FVirtualHostRoot/{1}
# TODO-Caddy RewriteRule ^/(.*)$ {{ slave_parameter.get('https-url', slave_parameter.get('url', '')) }}/VirtualHostBase/https//%{SERVER_NAME}:{{ slave_parameter.get('virtualhostroot-https-port', '443') }}/{{ slave_parameter.get('path', '') }}/VirtualHostRoot/$1 [L,P] }
{% elif slave_type == 'redirect' -%} {% elif slave_type == 'redirect' -%}
# TODO-Caddy RewriteRule (.*) {{ slave_parameter.get('https-url', slave_parameter.get('url', ''))}}$1 [R,L] # TODO-Caddy RewriteRule (.*) {{ slave_parameter.get('https-url', slave_parameter.get('url', ''))}}$1 [R,L]
{% else -%} {% else -%}
...@@ -109,14 +113,11 @@ ...@@ -109,14 +113,11 @@
# TODO-Caddy SSLProxyCheckPeerExpire on # TODO-Caddy SSLProxyCheckPeerExpire on
{% endif %} {% endif %}
# TODO-Caddy # Rewrite part # TODO-Caddy # Rewrite part
# TODO-Caddy ProxyPreserveHost On
# TODO-Caddy ProxyTimeout 600 # TODO-Caddy ProxyTimeout 600
{% if disable_via_header %} {% if disable_via_header %}
# TODO-Caddy Header unset Via # TODO-Caddy Header unset Via
{% endif -%} {% endif -%}
# TODO-Caddy RewriteEngine On
# TODO-Caddy # One Slave two logs # TODO-Caddy # One Slave two logs
# TODO-Caddy LogLevel notice # TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined # TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
...@@ -146,13 +147,19 @@ ...@@ -146,13 +147,19 @@
{% elif slave_type == 'redirect' -%} {% elif slave_type == 'redirect' -%}
# TODO-Caddy RewriteRule (.*) {{slave_parameter.get('url', '')}}$1 [R,L] # TODO-Caddy RewriteRule (.*) {{slave_parameter.get('url', '')}}$1 [R,L]
{% elif slave_type == 'zope' -%} {% elif slave_type == 'zope' -%}
proxy / {{ slave_parameter.get('https-url', slave_parameter.get('url', '')) }} {
transparent
}
{% if 'default-path' in slave_parameter %} {% if 'default-path' in slave_parameter %}
# TODO-Caddy RewriteRule ^/?$ {{ slave_parameter.get('default-path') }} [R=301,L] redir 301 {
if {path} is /
/ {scheme}://{host}/{{ slave_parameter.get('default-path') }}
}
{% endif -%} {% endif -%}
# First, we check if we have a zope backend server rewrite {
# If so, let's use Virtual Host Daemon rewrite regexp (.*)
# We suppose that Apache listens to 80 (even indirectly thanks to things like iptables) to /VirtualHostBase/{scheme}%2F%2F{hostonly}:{{ slave_parameter.get('virtualhostroot-http-port', '80') }}%2F{{ slave_parameter.get('path', '') }}%2FVirtualHostRoot/{1}
# TODO-Caddy RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/VirtualHostBase/http/%{SERVER_NAME}:{{ slave_parameter.get('virtualhostroot-http-port', '80') }}/{{ slave_parameter.get('path', '') }}/VirtualHostRoot/$1 [L,P] }
{% else -%} {% else -%}
{% if 'default-path' in slave_parameter %} {% if 'default-path' in slave_parameter %}
redir 301 { redir 301 {
......
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