Proxy Middleware


Hi All,

I’m looking at using the Proxy middleware to perform a request to another server and then use other middleware functions to perform the following:

  1. On particular status codes (i.e. 302) modify the Location header.
  2. On a specific URI, validate the status code (i.e. 200) and perform a few additional steps which include sending a cookie back to the client as part of the request. This also needs to read the body of the response from the Proxy’s target.

I’ve noticed that as soon as I have something along the lines of:


Any middleware after it (TestMiddlewareOne, TestMiddlewareTwo) does not execute.

This may also not be the right approach. The middleware that executes after the Proxy will contain a body with URL encoded form elements which require handling. The body isn’t altered, but the headers would be.


  1. How do I ensure that the Proxy middleware enables execution of subsequent middleware?
  2. Can middleware access the body of a response from an earlier middleware execution?