Update default.conf

This commit is contained in:
Oleg A 2022-04-05 00:00:18 +03:00 committed by GitHub
parent d76da0bef8
commit a3666b3040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,8 @@
# use $sanitized_request instead of $request to hide Telegram token
log_format token_filter '$remote_addr - $remote_user [$time_local] '
'"$sanitized_request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
upstream telegram-bot-api { upstream telegram-bot-api {
server api:8081; server api:8081;
} }
@ -15,6 +20,12 @@ server {
client_body_buffer_size 30M; client_body_buffer_size 30M;
keepalive_timeout 0; keepalive_timeout 0;
set $sanitized_request $request;
if ( $sanitized_request ~ (\/bot\d+):[-\w]+\/(\S+) ) {
set $sanitized_request $1:<hidden-token>/$2;
}
access_log /var/log/nginx/access.log token_filter;
location ~* \/file\/bot\d+:(.*) { location ~* \/file\/bot\d+:(.*) {
rewrite ^/file\/bot(.*) /$1 break; rewrite ^/file\/bot(.*) /$1 break;
try_files $uri @files; try_files $uri @files;