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
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.
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!
That sounds like exactly what I need! Thanks for the suggestion!