Elektrine lite

← Feed

@drwho@hackers.town

Post #2972681

2024-12-28 19:25 UTC

@niko@furry.engineer @kkarhan@infosec.space What do you use? .htaccess? Curious because I'm thinking of automating the deployment of such a configuration to all of my stuff.

Replies (1)

  • @niko@furry.engineer 2024-12-28 21:38

    @drwho@hackers.town @kkarhan@infosec.space i use nginx and a few if blocks (yes i'm aware if is evil but to the best of my knowledge if is the only way to get a boolean AND expression) set $redir_to_gz 1; if ($host = gz.niko.lgbt) { set $redir_to_gz 0; } if ($http_user_agent !~* (claudebot|ZoominfoBot|GPTBot|SeznamBot|DotBot|Amazonbot|DataForSeoBot|2ip|paloaltonetworks.com|SummalyBot|incestoma)) { set $redir_to_gz 0; } if ($redir_to_gz) { return 301 https://gz.niko.lgbt/; } as for the actual stuff behind gz.niko.lgbt server { # SSL and listen -- snipped # static files root /var/www/gz.niko.lgbt; location / { add_header Content-Encoding gzip; try_files /42.gz =404; gunzip off; types { text/html gz; } } # additional config -- snipped } gunzip off is very important because if the client doesn't support gzip encoding nginx will blow its foot off without that 42.gz is generated with dd if=/dev/zero bs=1M count=102400 | gzip -c - > 42.gz

    Open ##2972682