Given /etc/nginx/nginx.conf
:
events {}
http {
server {
listen 8000;
location / {
proxy_pass http://localhost:8001;
add_header X-Trip-Time $request_time;
add_header X-Process-Time $upstream_response_time;
}
}
}
Running:
python3 -u -m http.server 8001 > app.log 2>&1 & sudo nginx
followed by:
curl -i localhost:8000
shows these two headers:
X-Trip-Time: 0.001
X-Process-Time: -
I've seen this related question, which says this:
In case of internal error while connecting to an upstream or when a reply is taken from the cache, the variable is set to -
But my upstream server is successfully connected to as shown by cat app.log
:
127.0.0.1 - - [03/Feb/2021 19:41:44] "GET / HTTP/1.0" 200 -
What is the cause for $upstream_response_time
equaling -
, yet $request_time
works as expected?