September 11, 2023 04:34PM
Using Nginx Open source v1.20.2

I am defining resolver directive in http block, without "valid" parameter. For one specific location block, I want to override this resolver definition and set valid = 300s parameter.
When trying to define resolver directive in both http and location block, the configuration from http block seems to always take effect. The validity set to 300 seconds within that specific location block is ignored. DNS records of are not being cached for 300 seconds.

A dummy nginx config for demonstration:

http {

server {


location {
resolver valid=300s; # here dns is not cached for 300 seconds
set $backend
proxy_pass http://$backend
Subject Author Posted

How to override resolver directive validity in location block

agarwaso September 11, 2023 04:34PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 351
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready