From 3ebb8c1b03a5d3e004715195f4243a5dbb97a663 Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Mon, 1 Jul 2019 22:15:44 +0200 Subject: [PATCH] Add proxy location support --- README.md | 6 ++++++ defaults/main.yml | 3 +++ templates/reverse.caddy.j2 | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 4f86105..39bda68 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,12 @@ Role Variables - websocket_location: reverse destination point for websocket config - websocket_port: websocket port to redirect to - websocket: yes/no, enable websocket block in config file + +- proxy_rule: yes/no, enable specific proxy rule setup +- proxy_location: reverse destination point +- proxy_path: path to route proxy to +- proxy_port: proxy port to redirect to + - vhost_name: name of the vhost Dependencies diff --git a/defaults/main.yml b/defaults/main.yml index bf4de6b..a7d8eeb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,4 +15,7 @@ vhost_name: default websocket: no websocket_location: localhost +proxy_rule: no +proxy_location: localhostœ + rootws: no \ No newline at end of file diff --git a/templates/reverse.caddy.j2 b/templates/reverse.caddy.j2 index 1cd099d..327d5cb 100644 --- a/templates/reverse.caddy.j2 +++ b/templates/reverse.caddy.j2 @@ -25,6 +25,12 @@ } {% endif %} +{% if proxy_rule %} + proxy {{ proxy_path }} http://{{ proxy_location }}:{{ proxy_port }} { + transparent + } +{% endif %} + log {{ caddy_logs }}/{{ vhost_name }}/access.log { rotate_size 100 rotate_age 30