T
T
Troodi Larson2021-02-10 12:13:02
Nginx
Troodi Larson, 2021-02-10 12:13:02

Why doesn't timeout work in location?

Why doesn't nginx change timeout values ​​for a specific location?

location /example {
      proxy_read_timeout 5s;
      proxy_connect_timeout 5s;
      proxy_send_timeout 5s; 
      try_files $uri $uri/ /index.php/exl?$query_string;
}

If you put return 500 there, it will return an error, which means that the location itself is seen as a priority. But the execution time is still more than 5 seconds...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dodo512, 2021-02-10
@troodi

location /example {
    try_files $uri @backend;
}

location @backend {
    proxy_read_timeout 5s;
    proxy_connect_timeout 5s;
    proxy_send_timeout 5s;

    rewrite ^ /index.php/exl break;

    proxy_pass http://backend;
}

Or
location /example {
    proxy_read_timeout 5s;
    proxy_connect_timeout 5s;
    proxy_send_timeout 5s; 

    rewrite ^ /index.php/exl break;

    proxy_pass http://backend;
}

K
ky0, 2021-02-10
@ky0

Because, obviously, the request in accordance with try_filesleaves for some other location, where the timeouts are different.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question