spring-cloud-gateway
spring-cloud-gateway copied to clipboard
fix: Ignore the Upgrade Websocket request
spring:
cloud:
gateway:
globalcors:
cors-configurations:
'[/**]':
allowedOriginPatterns: "*"
allowedHeaders: "*"
allowedMethods: "*"
allowCredentials: true
routes:
- id: test-stomp-info
uri: lb://test
predicates:
- Path=/test/ws/stomp/info/**
- id: rbac-stomp
uri: lb:ws://test
predicates:
- Path=/test/ws/stomp/**
- id: rbac
uri: lb://test
predicates:
- Path=/**
default-filters:
- AddResponseHeader=Access-Control-Allow-Origin, *
- AddResponseHeader=Access-Control-Allow-Methods, *
- AddResponseHeader=Access-Control-Allow-Headers, *
- AddResponseHeader=Access-Control-Allow-Credentials, true
- DedupeResponseHeader=Vary Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_FIRST
When forwarding the Websocket request in the above configuration, the forwarding may fail due to the modification of the Header. In this case, the DedupeResponseHeader needs to ignore the processing of the Upgrade request
@houkunlin Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
@houkunlin Thank you for signing the Contributor License Agreement!
I don't understand, you're saying don't dedupe in certain cases? I think then, the dedupe filter shouldn't be a default one.
Header information of cross-domain scenarios is processed at the gateway, and cross-domain headers are deduplicated. If they are not placed in the default filter, each of them needs to be set.
Can you explain how to duplicate this? or add a test?