5

Our team has developed an analytic app which records and analyses all incoming (not dropped) requests. To that extent, I have to send a copy of all requests to another upstream in my reverse-proxy solution.

Is it possible with NGINX alone? Or is there any other solution with minimum impact on the current reverse-proxy structure?

It is preferable to do so within NGINX so that processes on requests by NGINX is already done and the request will be the same as it is sent to destination upstream.

PS: The analytic app does not return any response

7
3

After some searhing in nginx docs I found a directory mirror in nginx.org. Think, this is what u need.

We are using kubernetes with nginx as ingress, so our config is

      location /api/what-i-want-to-mirror {
          set $proxy_upstream_name "gateway-api-service-svc-80";
          proxy_pass http://upstream_balancer;
          mirror /mirror;

          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }

      location = /mirror {
          set $proxy_upstream_name "integration-gateway-api-service-svc-80";
          proxy_pass http://upstream_balancer;
          internal;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

          proxy_set_header X-Original-URI $request_uri;
      }

We've done this as ASAP but it works like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.