service: Option to not pass host header to container service

This commit is contained in:
uumas
2025-04-05 04:38:57 +03:00
parent 6acdcd6dac
commit 093e7846ad
4 changed files with 12 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
---
service_domains: []
service_vhost_locations: []
service_proxy_pass_host_header: true
service_container_additional_networks: []
service_container_user: ""

View File

@@ -20,8 +20,14 @@ argument_specs:
- Required if service_domains is not empty.
type: int
required: false
service_proxy_pass_host_header:
description: Passed to vhost role as vhost_proxy_pass_header
type: bool
required: false
default: true
service_vhost_locations:
description: Passed to vhost role as vhost_locations
type: list
required: false
default: []

View File

@@ -33,4 +33,5 @@
vhost_domains: "{{ service_domains }}"
vhost_proxy_target_netproto: unix
vhost_proxy_target_socket: "/run/{{ service_name }}-socat.sock"
vhost_proxy_headers: "{{ _service_proxy_headers }}"
vhost_locations: "{{ service_vhost_locations }}"

View File

@@ -19,3 +19,7 @@ _service_container_secrets: >
_service_container_requires: "{{ service_requires + ([_service_database_name + '.service'] if _service_setup_database else []) }}"
_service_container_wants: "{{ service_wants + ([service_name + '-socat.socket'] if service_domains | length > 0 else []) }}"
_service_replacement_host_header:
Host: "{{ service_name }}:{{ service_container_http_port }}"
_service_proxy_headers: "{{ _service_replacement_host_header if not service_proxy_pass_host_header else {} }}"