Sebastian Kippe 49c75bbb05
Add Onion-Location header for kosmos.social
Tells Tor Browser where to find the native onion site.

refs #201
2021-01-25 12:09:28 +01:00

41 lines
940 B
Plaintext

<% if @onion_address %>
server {
listen 80;
server_name mastodon.<%= @onion_address %>;
include <%= @shared_config_path %>;
}
<% end %>
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) %>
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name <%= @server_name %>;
include <%= @shared_config_path %>;
ssl_certificate <%= @ssl_cert %>;
ssl_certificate_key <%= @ssl_key %>;
add_header Strict-Transport-Security "max-age=31536000";
add_header Onion-Location https://mastodon.<%= @onion_address %>$request_uri;
}
<% end %>
<% if @onion_address %>
server {
listen 443 ssl http2;
server_name mastodon.<%= @onion_address %>;
include <%= @shared_config_path %>;
ssl_certificate <%= @ssl_cert %>;
ssl_certificate_key <%= @ssl_key %>;
add_header Strict-Transport-Security "max-age=31536000";
}
<% end %>