Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

490
Views
nginx: why no access log for rediect location

My nginx config file goes following:

server {        
    location /mysite {
        auth_request /authVerify;
        proxy_pass http://localhost:4200;
        error_page 401 = /login;
    }

    location /authVerify {
        proxy_pass_request_body off;
        proxy_set_header Content-Length "";
        proxy_set_header X-Original-URI $request_uri;
        proxy_pass http://localhost:3000;
    }

    location /login {
        proxy_cookie_path / "/; HttpOnly";
        proxy_pass http://localhost:3000;
    }

    location / {
        root   html;
        index  index.html index.htm;
    }
}

log related configs use the default settings.

the auth_request configration works. But when I send request to /mysite, there is only logging of it in access log, there is no logging of /authVerify although it actually proxy through this locatoin. If I send request to /authVerify directly, there will be loggings as well.

So in the redirect cases how to produce logs for all the locations the request running through?

Update Based on the comment, I set log_subrequest as on in http block level. After this change, the logs of internal rediect was produced, but the log of original mysite location disappear.

Currently after I send one request to /mysite, the log is as following:

enter image description here

I found the following explanation on nginx doc:

Requests are logged in the context of a location where processing ends. It may be different from the original location, if an internal redirect happens during request processing.

http://nginx.org/en/docs/http/ngx_http_log_module.html

Is that because of that? Any more methods to log the request's entire flow?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Have you tried enabling log_subrequest?

log_subrequest

Context: http, server, and location

Enables or disables logging of sub-requests triggered by internal redirects or SSI requests.

Syntax: on or off

Default value: off
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!