Welcome! Log In Create A New Profile


How to override resolver directive validity in location block

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 foo.com are not being cached for 300 seconds.

A dummy nginx config for demonstration:

http {

server {

server_name something.com;

location {
resolver valid=300s; # here dns is not cached for 300 seconds
set $backend foo.com
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: 127
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