|
|
|
@ -190,16 +190,13 @@ public class EncoderHandler extends ChannelOutboundHandlerAdapter {
|
|
|
|
|
res.headers().add(HttpHeaderNames.SERVER, version); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (configuration.getOrigin() != null) { |
|
|
|
|
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN, configuration.getOrigin()); |
|
|
|
|
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_CREDENTIALS, Boolean.TRUE); |
|
|
|
|
} else { |
|
|
|
|
if (origin != null) { |
|
|
|
|
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN, origin); |
|
|
|
|
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_CREDENTIALS, Boolean.TRUE); |
|
|
|
|
} else { |
|
|
|
|
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN, "*"); |
|
|
|
|
if (origin != null) { |
|
|
|
|
String configOrigin = configuration.getOrigin(); |
|
|
|
|
if (configOrigin != null && !"".equals(configOrigin) && !configOrigin.contains(origin)) { |
|
|
|
|
throw new IllegalArgumentException(); |
|
|
|
|
} |
|
|
|
|
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN, origin); |
|
|
|
|
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_CREDENTIALS, Boolean.TRUE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|