Update BeforeFilterFunctions.preserveHostHeader() for compatibility
This commit is contained in:
@@ -193,7 +193,7 @@ public abstract class BeforeFilterFunctions {
|
||||
};
|
||||
}
|
||||
|
||||
public static Function<ServerRequest, ServerRequest> preserveHost() {
|
||||
public static Function<ServerRequest, ServerRequest> preserveHostHeader() {
|
||||
return request -> {
|
||||
request.attributes().put(MvcUtils.PRESERVE_HOST_HEADER_ATTRIBUTE, true);
|
||||
return request;
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface FilterFunctions {
|
||||
|
||||
@Shortcut
|
||||
static HandlerFilterFunction<ServerResponse, ServerResponse> preserveHost() {
|
||||
return ofRequestProcessor(BeforeFilterFunctions.preserveHost());
|
||||
return ofRequestProcessor(BeforeFilterFunctions.preserveHostHeader());
|
||||
}
|
||||
|
||||
static HandlerFilterFunction<ServerResponse, ServerResponse> redirectTo(int status, URI uri) {
|
||||
|
||||
@@ -90,7 +90,7 @@ import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFu
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.fallbackHeaders;
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.mapRequestHeader;
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.modifyRequestBody;
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.preserveHost;
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.preserveHostHeader;
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.removeRequestParameter;
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.requestHeaderSize;
|
||||
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.requestHeaderToRequestUri;
|
||||
@@ -737,7 +737,7 @@ public class ServerMvcIntegrationTests {
|
||||
return route("testhostpredicate")
|
||||
.route(host("{sub}.myjavadslhost.com").and(path("/anything/hostpredicate")), http())
|
||||
.before(new HttpbinUriResolver())
|
||||
.before(preserveHost())
|
||||
.before(preserveHostHeader())
|
||||
.after(addResponseHeader("X-SubDomain", "{sub}"))
|
||||
.build();
|
||||
// @formatter:on
|
||||
|
||||
Reference in New Issue
Block a user