Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Add a simple /healthz path on the Nginx frontend #1557

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions global_vars/default-site.yml
Expand Up @@ -25,3 +25,6 @@ streisand_tinyproxy_enabled: yes
streisand_tor_enabled: no
streisand_wireguard_enabled: yes
streisand_cloudflared_enabled: no

# Simple /robots.txt; can also be used for health checks
streisand_gateway_robots_txt_enabled: no
8 changes: 8 additions & 0 deletions playbooks/customize.yml
Expand Up @@ -60,6 +60,10 @@
prompt: "[BROKEN ON SOME PROVIDERS, including AWS] Enable DNS-over-HTTPS (cloudflared)? Press enter for default "
default: "no"
private: no
- name: streisand_gateway_robots_txt_enabled
prompt: "Enable a minimal /robots.txt in the UI; also useful for remote health checks "
default: "no"
private: no

tasks:
- lineinfile:
Expand Down Expand Up @@ -118,3 +122,7 @@
path: "{{ streisand_site_vars }}"
regexp: "^streisand_cloudflared_enabled: (?:yes|no|True|False)$"
line: "streisand_cloudflared_enabled: {{ streisand_cloudflared_enabled|bool }}"
- lineinfile:
path: "{{ streisand_site_vars }}"
regexp: "^streisand_gateway_robots_txt_enabled: (?:yes|no|True|False)$"
line: "streisand_gateway_robots_txt_enabled: {{ streisand_gateway_robots_txt_enabled }}"
12 changes: 10 additions & 2 deletions playbooks/roles/streisand-gateway/templates/vhost.j2
Expand Up @@ -80,9 +80,17 @@ server {

root {{ streisand_gateway_location }};
index index.html index.htm;

location / {
autoindex off;
autoindex off;
}

{% if streisand_gateway_robots_txt_enabled %}
# Simple /robots.txt; can also be used for health checks
location = /robots.txt {
auth_basic off;
add_header Content-Type text/plain;
return 200 "User-agent: *\nDisallow: /\n";
}
{% endif %}
}