Welcome! Log In Create A New Profile

Advanced

Re: How to write $upstream_trailer_{name} into access.log

Andrey Kopeyko
May 22, 2021 06:26PM
Gena Makhomed писал 2021-05-23 01:00:
> Здравствуйте, All!

Добрый день, Геннадий!

> Использую nginx/1.19.10 из официального репозитория nginx.org
>
> На бэкенде в секции http прописал такие директивы:
>
> add_trailer X-Response-Time $upstream_response_time always;
> add_trailer X-Cache-Status $upstream_cache_status always;
>
> На фронтенде в секции http прописал proxy_http_version 1.1;
> Также на фронтенде в директиву log_format добавил переменные:
>
> $upstream_trailer_x_response_time $upstream_trailer_x_cache_status
>
> Ожидается что в лог будут записаны полученные значения этих переменных,
> но вместо них в лог пишутся символы - - обозначающие пустые значения.
>
> Почему так происходит?

Очевидно, потому что бэкенд _не_ возвращал вам заголовков
"trailer-x-response-time: " - вы их сами выдумали.

А что вам мешает писать в лог значения $upstream_response_time и
$upstream_cache_status из которых вы свои кастомные заголовки строите?

> Это ошибка в nginx или я что-то делаю не так?

--
Best regards,
Andrey A. Kopeyko <andrey@kopeyko.ru>
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

How to write $upstream_trailer_{name} into access.log

Gena Makhomed May 22, 2021 06:02PM

Re: How to write $upstream_trailer_{name} into access.log

Andrey Kopeyko May 22, 2021 06:26PM

Re: How to write $upstream_trailer_{name} into access.log

Gena Makhomed May 22, 2021 06:52PM

Re: How to write $upstream_trailer_{name} into access.log

Andrey Kopeyko May 22, 2021 08:58PM

Re: How to write $upstream_trailer_{name} into access.log

Andrey Kopeyko May 22, 2021 09:06PM

Re: How to write $upstream_trailer_{name} into access.log

Maxim Dounin May 23, 2021 09:20PM

Re: How to write $upstream_trailer_{name} into access.log

Илья Шипицин May 23, 2021 11:42PM

Re: How to write $upstream_trailer_{name} into access.log

Gena Makhomed May 25, 2021 04:08AM

Re: How to write $upstream_trailer_{name} into access.log

Maxim Dounin May 25, 2021 08:02AM

add_header

Gena Makhomed May 25, 2021 09:44AM

Re: add_header

Илья Шипицин May 25, 2021 09:54AM

Re: add_header

Maxim Dounin May 25, 2021 10:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 314
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready