Can Nginx Proxy Pass to Multiple URLs at Once?

0
10
Asked By TechieNinja27 On

I'm trying to configure Nginx to proxy requests to more than one URL simultaneously. Specifically, when hitting the `/foo` location, I want to use `proxy_pass` to send the request to both `http://foo$request_uri` and `http://bar$request_uri`. Is this possible?

2 Answers

Answered By HelpfulHarry42 On

You might find what you’re looking for in the Nginx mirror module. It allows you to 'mirror' requests to another upstream server while responding from the primary one. So, it could work for your use case where you want to send the request to one server and still fire off a copy to another without worrying about the second response.

TechieNinja27 -

That sounds like exactly what I need! Thanks for the suggestion!

Answered By CuriousCoder56 On

It sounds like you're looking for a way to send the same request to multiple endpoints at once. Technically, Nginx isn’t built to handle sending a request to multiple URLs simultaneously in the way you might want. But if you only want to send the request to one remote and have a backup, you could leverage Nginx's upstream features to attempt connections in sequence. Check out the documentation on the upstream module for more info!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.