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

90
Views
nginx - dns resolution in njs

I need to solve a simple DNS query using njs in nginx.

I've searched but it seems that there isn't a 'native' function for doing this.

So I'm trying to use dns-lookup module for node.js I've installed it using npm install dns-lookup, then I've tried to use it in my njs script, with something like:

var lookup = require('dns-lookup');
ip = lookup.resolve(hostname);

But when I run this script I receive an error:

[error] 13555#13555: *124 js exception: Error: Cannot find module "dns-lookup"

1st question, is it right what I'm doing? How can I load an external module in my js file?

2nd question, do you know how to solve? And/or is there a better way for do a DNS resolution?

I've found a similar question here in stackoverflow but without answers

Thanks in advance

over 4 years ago · Santiago Trujillo
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!