SaveSession Filter

The SaveSession filter forces a WebSession::save operation before forwarding the call downstream. This is of particular use when using something like Spring Session with a lazy data store, and you need to ensure the session state has been saved before making the forwarded call. The following example configures a SaveSession filter:

application.yml
spring:
  cloud:
    gateway:
      mvc:
        routes:
        - id: save_session
          uri: https://example.org
          predicates:
          - Path=/foo/**
          filters:
          - SaveSession=

If you integrate Spring Security with Spring Session and want to ensure security details have been forwarded to the remote process, this is critical.