title: Is it possible to branch between 2 spring filter chains based on the result of a filter?
body: <p>tl;dr: I want to selectively apply filters based on the value of a req header without modifying each filter to check the header. Is this in some way possible?</p>
  <p>Very happy to receive alternative/better solutions.</p>
  <p>I have a Jetty web server with spring that is web-facing and I want to migrate it behind a proxy server.</p>
  <p>In order to test it behind the proxy first, I need it to be able to receive both direct and proxied requests simultaneously. Some filters that are applied for direct requests will fail behind the proxy as they are handled by the proxy and not supported when proxied.</p>
  <p>A solution I'm considering is sending a verifiable header from the proxy that the server can use to selectively apply/skip filters. This will work but adds a mess of migration logic that will need to be cleaned up afterwards.</p>
  <p>Is it possible to (using a filter or otherwise) select between multiple filter chains to handle a request? I believe spring security does something like this for its auth flow but I'm not familiar with how it's implemented or how to do it myself.</p>
  <p>I know Spring supports multiple filter chains if they match different paths but in my case, the paths are the same.</p>