Update to caddy2

This commit is contained in:
Wilfried OLLIVIER 2020-05-19 21:28:43 +02:00
parent 96fbf95ec1
commit 790f42bbb8
4 changed files with 7 additions and 26 deletions

View file

@ -18,7 +18,6 @@ Role Variables
- caddy_www: /var/www/caddy - caddy_www: /var/www/caddy
- reverse_location: reverse destination point - reverse_location: reverse destination point
- reverse_port: port to redirect to - reverse_port: port to redirect to
- rootws: yes/no activate websocket in the / path
- websocket_path: path to websocket (optional) - websocket_path: path to websocket (optional)
- websocket_location: reverse destination point for websocket config - websocket_location: reverse destination point for websocket config
- websocket_port: websocket port to redirect to - websocket_port: websocket port to redirect to
@ -51,4 +50,3 @@ Needs galaxy-vagrant to run tests
Ensure galaxy-vagrant is up Ensure galaxy-vagrant is up
ansible-playbook -i tests/inventory tests/test.yml ansible-playbook -i tests/inventory tests/test.yml

View file

@ -16,6 +16,6 @@ websocket: no
websocket_location: localhost websocket_location: localhost
proxy_rule: no proxy_rule: no
proxy_location: localhostœ proxy_location: localhost
rootws: no rootws: no

View file

@ -1,6 +1,6 @@
galaxy_info: galaxy_info:
author: Wilfried OLLIVIER author: Wilfried OLLIVIER
description: Push caddy reverse config file description: Push caddy (2) reverse config file
company: none company: none
license: WTFPL license: WTFPL

View file

@ -12,35 +12,18 @@
X-Frame-Options "DENY" X-Frame-Options "DENY"
} }
proxy / http://{{ reverse_location }}:{{ reverse_port }} { reverse_proxy http://{{ reverse_location }}:{{ reverse_port }}
{% if rootws %}
websocket
{% endif %}
transparent
}
{% if websocket %} {% if websocket %}
proxy {{ websocket_path }} http://{{ websocket_location }}:{{ websocket_port }} { reverse_proxy {{ websocket_path }} http://{{ websocket_location }}:{{ websocket_port }}
websocket
}
{% endif %} {% endif %}
{% if proxy_rule %} {% if proxy_rule %}
proxy {{ proxy_path }} http://{{ proxy_location }}:{{ proxy_port }} { reverse_proxy {{ proxy_path }} http://{{ proxy_location }}:{{ proxy_port }}
transparent
}
{% endif %} {% endif %}
log {{ caddy_logs }}/{{ vhost_name }}/access.log { log {
rotate_size 100 output file {{ caddy_logs }}/{{ vhost_name }}/vhost.log
rotate_age 30
rotate_keep 10
}
errors {{ caddy_logs }}/{{ vhost_name }}/errors.log {
rotate_size 100
rotate_age 30
rotate_keep 10
} }
} }