57 lines
3 KiB
Django/Jinja
57 lines
3 KiB
Django/Jinja
{% if searxng_container_labels_traefik_enabled %}
|
|
traefik.enable=true
|
|
|
|
{% if searxng_container_labels_traefik_docker_network %}
|
|
traefik.docker.network={{ searxng_container_labels_traefik_docker_network }}
|
|
{% endif %}
|
|
|
|
{% set middlewares = [] %}
|
|
|
|
{% if searxng_basic_auth_enabled %}
|
|
traefik.http.middlewares.{{ searxng_identifier }}-auth.basicauth.users={{ searxng_container_label_basicauth_users }}
|
|
{% set middlewares = middlewares + [searxng_identifier + '-auth'] %}
|
|
{% endif %}
|
|
|
|
{% if searxng_container_labels_traefik_path_prefix != '/' %}
|
|
traefik.http.middlewares.{{ searxng_identifier }}-slashless-redirect.redirectregex.regex=https?://([^/]+)({{ searxng_container_labels_traefik_path_prefix | quote }})$
|
|
traefik.http.middlewares.{{ searxng_identifier }}-slashless-redirect.redirectregex.replacement=${2}/
|
|
{% set middlewares = middlewares + [searxng_identifier + '-slashless-redirect'] %}
|
|
{% endif %}
|
|
|
|
{% if searxng_container_labels_traefik_path_prefix != '/' %}
|
|
traefik.http.middlewares.{{ searxng_identifier }}-strip-prefix.stripprefix.prefixes={{ searxng_container_labels_traefik_path_prefix }}
|
|
{% set middlewares = middlewares + [searxng_identifier + '-strip-prefix'] %}
|
|
{% endif %}
|
|
|
|
{% if searxng_container_labels_traefik_additional_request_headers.keys() | length > 0 %}
|
|
{% for name, value in searxng_container_labels_traefik_additional_request_headers.items() %}
|
|
traefik.http.middlewares.{{ searxng_identifier }}-add-request-headers.headers.customrequestheaders.{{ name }}={{ value }}
|
|
{% endfor %}
|
|
{% set middlewares = middlewares + [searxng_identifier + '-add-request-headers'] %}
|
|
{% endif %}
|
|
|
|
{% if searxng_container_labels_traefik_additional_response_headers.keys() | length > 0 %}
|
|
{% for name, value in searxng_container_labels_traefik_additional_response_headers.items() %}
|
|
traefik.http.middlewares.{{ searxng_identifier }}-add-response-headers.headers.customresponseheaders.{{ name }}={{ value }}
|
|
{% endfor %}
|
|
{% set middlewares = middlewares + [searxng_identifier + '-add-response-headers'] %}
|
|
{% endif %}
|
|
|
|
traefik.http.routers.{{ searxng_identifier }}.rule={{ searxng_container_labels_traefik_rule }}
|
|
{% if searxng_container_labels_traefik_priority | int > 0 %}
|
|
traefik.http.routers.{{ searxng_identifier }}.priority={{ searxng_container_labels_traefik_priority }}
|
|
{% endif %}
|
|
traefik.http.routers.{{ searxng_identifier }}.service={{ searxng_identifier }}
|
|
{% if middlewares | length > 0 %}
|
|
traefik.http.routers.{{ searxng_identifier }}.middlewares={{ middlewares | join(',') }}
|
|
{% endif %}
|
|
traefik.http.routers.{{ searxng_identifier }}.entrypoints={{ searxng_container_labels_traefik_entrypoints }}
|
|
traefik.http.routers.{{ searxng_identifier }}.tls={{ searxng_container_labels_traefik_tls | to_json }}
|
|
{% if searxng_container_labels_traefik_tls %}
|
|
traefik.http.routers.{{ searxng_identifier }}.tls.certResolver={{ searxng_container_labels_traefik_tls_certResolver }}
|
|
{% endif %}
|
|
|
|
traefik.http.services.{{ searxng_identifier }}.loadbalancer.server.port={{ searxng_container_http_port }}
|
|
{% endif %}
|
|
|
|
{{ searxng_container_labels_additional_labels }}
|