The Spring Cloud Gateway works correctly in older applications.
Older app's pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>corp.com</groupId>
<artifactId>im</artifactId>
<version>2.0.0-rc11-SNAPSHOT</version>
<name>im</name>
<description>IM app</description>
<properties>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
<exclusions>
<exclusion>
<groupId>io.undertow</groupId>
<artifactId>undertow-websockets-jsr</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
But when I try with a new app:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>corp.com</groupId>
<artifactId>ktr</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ktr</name>
<packaging>pom</packaging>
<description>KTR Root</description>
<modules>
<module>ktr-backend</module>
<module>ktr-frontend</module>
</modules>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>corp.com</groupId>
<artifactId>ktr</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>ktr-backend</artifactId>
<name>ktr-backend</name>
<description>KTR</description>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<log4j2.version>2.16.0</log4j2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.9</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-security</artifactId>
<version>1.6.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
<exclusions>
<exclusion>
<groupId>io.undertow</groupId>
<artifactId>undertow-websockets-jsr</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
I have the following error -> GET https://lts.corp.app.com:8443/ktr-api/backend/list-data log:
|TRACE|http-nio-2|erver.adapter.HttpWebHandlerAdapter|[162c8bde] HTTP GET "/ktr-api/backend/list-data", headers={masked}
|TRACE|http-nio-2|ay.filter.WeightCalculatorWebFilter|Weights attr: {}
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/cdp/**]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/dr/**]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/dw/**]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/pi/**]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/tat/**]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/im/**]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/ktr-api/backend/list-data"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "/ktr-api/**" matches against value "/ktr-api/backend/list-data"
|DEBUG|http-nio-2|andler.RoutePredicateHandlerMapping|Route matched: ktr-api
|DEBUG|http-nio-2|andler.RoutePredicateHandlerMapping|Mapping [Exchange: GET https://lts.corp.app.com:8443/ktr-api/backend/list-data] to Route{id='api', uri=http://localhost:8445, order=0, predicate=Paths: [/ktr-api/**], match trailing slash: true, gatewayFilters=[[[StripPrefix parts = 1], order = 1]], metadata={}}
|DEBUG|http-nio-2|andler.RoutePredicateHandlerMapping|[162c8bde] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@783cd7f0
|DEBUG|http-nio-2|gateway.handler.FilteringWebHandler|Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@56de6d6b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@bcb09a6}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@5e840abf}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@31e32ea2}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@5b5c0057}, order = 0], [[StripPrefix parts = 1], order = 1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@5972d253}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.config.GatewayNoLoadBalancerClientAutoConfiguration$NoLoadBalancerClientFilter@749f539e}, order = 10100], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@1473b8c0}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@1280851e}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@4fcc0416}, order = 2147483647]]
|TRACE|http-nio-2|eway.filter.RouteToRequestUrlFilter|RouteToRequestUrlFilter start
|TRACE|http-nio-2|d.gateway.filter.NettyRoutingFilter|outbound route: 73c9c229, inbound: [162c8bde]
|TRACE|http-nio-2|ive.function.server.RouterFunctions|[162c8bde] Matched org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler$$Lambda$1024/0x0000000840774840@795b4c1a
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'server.ports'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'configurationProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'gateway-properties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'systemProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'systemEnvironment'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'random'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'springCloudClientHostInfo'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'applicationConfig: [file:./config/cag-test.yaml]'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'applicationConfig: [classpath:/application.yaml]'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'springCloudDefaultProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'Management Server'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Could not find key 'spring.template.provider.cache' in any property source
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'server.ports'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'configurationProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'gateway-properties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'systemProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'systemEnvironment'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'random'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'springCloudClientHostInfo'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'applicationConfig: [file:./config/cag-test.yaml]'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'applicationConfig: [classpath:/application.yaml]'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'springCloudDefaultProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'Management Server'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Could not find key 'spring.template.provider.cache' in any property source
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'server.ports'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'configurationProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'gateway-properties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'systemProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'systemEnvironment'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'random'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'springCloudClientHostInfo'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'applicationConfig: [file:./config/cag-test.yaml]'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'applicationConfig: [classpath:/application.yaml]'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'springCloudDefaultProperties'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Searching for key 'spring.template.provider.cache' in PropertySource 'Management Server'
|TRACE|http-nio-2|env.PropertySourcesPropertyResolver|Could not find key 'spring.template.provider.cache' in any property source
|DEBUG|http-nio-2|org.springframework.web.HttpLogging|[162c8bde] Resolved [PrematureCloseException: Connection prematurely closed BEFORE response] for HTTP GET /ktr-api/backend/list-data
|ERROR|http-nio-2|or.AbstractErrorWebExceptionHandler|[162c8bde] 500 Server Error for HTTP GET "/ktr-api/backend/list-data"
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.authentication.logout.LogoutWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP GET "/ktr-api/backend/list-data" [ExceptionHandlingWebHandler]
Stack trace:
|TRACE|http-nio-2|work.core.codec.CharSequenceEncoder|[162c8bde] Writing "<html><body><h1>Whitelabel Error Page</h1><p>This application has no configured error view, so you are seeing this as a fallback.</p><div id='created'>Tue Aug 02 14:01:08 CEST 2022</div><div>[162c8bde] There was an unexpected error (type=Internal Server Error, status=500).</div><div>An internal server error occurred. Please see logs for details.</div></body></html>"
|TRACE|http-nio-2|gateway.filter.GatewayMetricsFilter|gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=500),tag(outcome=SERVER_ERROR),tag(routeId=api),tag(routeUri=http://localhost:8445),tag(status=INTERNAL_SERVER_ERROR)]
|TRACE|http-nio-2|erver.adapter.HttpWebHandlerAdapter|[162c8bde] Completed 500 INTERNAL_SERVER_ERROR, headers={masked}
|TRACE|http-nio-2|.reactive.ReactorHttpHandlerAdapter|[162c8bde] Handling completed
|TRACE|http-nio-2|erver.adapter.HttpWebHandlerAdapter|[162c8bde] HTTP GET "/favicon.ico", headers={masked}
|TRACE|http-nio-2|ay.filter.WeightCalculatorWebFilter|Weights attr: {}
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/cdp/**]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/dr/**]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/dw/**]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/pi/**]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/tat/**]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/im/**]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/ktr-api/**]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|ler.predicate.RoutePredicateFactory|Pattern "[/v3/api-docs]" does not match against value "/favicon.ico"
|TRACE|http-nio-2|andler.RoutePredicateHandlerMapping|No RouteDefinition found for [Exchange: GET https://lts.corp.app.com:8443/favicon.ico]
|DEBUG|http-nio-2|ive.handler.SimpleUrlHandlerMapping|[162c8bde] Mapped to ResourceWebHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"]
|DEBUG|http-nio-2|ramework.core.codec.ResourceEncoder|[162c8bde] Writing [class path resource [static/favicon.ico]]
|TRACE|http-nio-2|erver.adapter.HttpWebHandlerAdapter|[162c8bde] Completed 200 OK, headers={masked}
|TRACE|http-nio-2|.reactive.ReactorHttpHandlerAdapter|[162c8bde] Handling completed
And this is the log with an older app -> GET https://lts.corp.app.com:8443/im/activity/asd/1
|TRACE|http-nio-1|erver.adapter.HttpWebHandlerAdapter|[da7e5ce1] HTTP GET "/im/activity/asd/1", headers={masked}
|TRACE|http-nio-1|ay.filter.WeightCalculatorWebFilter|Weights attr: {}
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/cdp/**]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/dr/**]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/dw/**]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/pi/**]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/tat/**]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "[/v2/api-docs]" does not match against value "/im/activity/asd/1"
|TRACE|http-nio-1|ler.predicate.RoutePredicateFactory|Pattern "/im/**" matches against value "/im/activity/asd/1"
|DEBUG|http-nio-1|andler.RoutePredicateHandlerMapping|Route matched: im
|DEBUG|http-nio-1|andler.RoutePredicateHandlerMapping|Mapping [Exchange: GET https://lts.corp.app.com:8443/im/activity/asd/1] to Route{id='im', uri=http://localhost:8086, order=0, predicate=Paths: [/im/**], match trailing slash: true, gatewayFilters=[[[StripPrefix parts = 1], order = 1]], metadata={}}
|DEBUG|http-nio-1|andler.RoutePredicateHandlerMapping|[da7e5ce1] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@783cd7f0
|DEBUG|http-nio-1|gateway.handler.FilteringWebHandler|Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@56de6d6b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@bcb09a6}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@5e840abf}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@31e32ea2}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@5b5c0057}, order = 0], [[StripPrefix parts = 1], order = 1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@5972d253}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.config.GatewayNoLoadBalancerClientAutoConfiguration$NoLoadBalancerClientFilter@749f539e}, order = 10100], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@1473b8c0}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@1280851e}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@4fcc0416}, order = 2147483647]]
|TRACE|http-nio-1|eway.filter.RouteToRequestUrlFilter|RouteToRequestUrlFilter start
|TRACE|http-nio-1|d.gateway.filter.NettyRoutingFilter|outbound route: 0aeb1fcf, inbound: [da7e5ce1]
|TRACE|http-nio-1|way.filter.NettyWriteResponseFilter|NettyWriteResponseFilter start inbound: 0aeb1fcf, outbound: [da7e5ce1]
|TRACE|http-nio-1|gateway.filter.GatewayMetricsFilter|gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=200),tag(outcome=SUCCESSFUL),tag(routeId=im),tag(routeUri=http://localhost:8086),tag(status=OK)]
|TRACE|http-nio-1|erver.adapter.HttpWebHandlerAdapter|[da7e5ce1] Completed 200 OK, headers={masked}
|TRACE|http-nio-1|.reactive.ReactorHttpHandlerAdapter|[da7e5ce1] Handling completed
gateway's pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.corp</groupId>
<artifactId>api-gateway</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>api-gateway</name>
<description>API Gateway</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Gateway's application.yaml:
server:
port: 8443
spring:
application:
name: @project.name@
boot:
admin:
client:
api-path: /admin/instance
main:
banner-mode: "off"
web-application-type: reactive
cloud:
gateway:
routes:
- id: cdp
uri: http://localhost:8081
predicates:
- Path=/cdp/**
filters:
- StripPrefix=1
- id: cdp-swagger
uri: http://localhost:8081
predicates:
- Path=/v2/api-docs
- Query=group, cdp-tasks
- id: dr
uri: http://localhost:8082
predicates:
- Path=/dr/**
filters:
- StripPrefix=1
- id: dr-swagger
uri: http://localhost:8082
predicates:
- Path=/v2/api-docs
- Query=group, dr-tasks
- id: dw
uri: http://localhost:8083
predicates:
- Path=/dw/**
filters:
- StripPrefix=1
- id: dw-swagger
uri: http://localhost:8083
predicates:
- Path=/v2/api-docs
- Query=group, dw-tasks
- id: pi
uri: http://localhost:8084
predicates:
- Path=/pi/**
filters:
- StripPrefix=1
- id: pi-swagger
uri: http://localhost:8084
predicates:
- Path=/v2/api-docs
- Query=group, pi-tasks
- id: tat
uri: http://localhost:8085
predicates:
- Path=/tat/**
filters:
- StripPrefix=1
- id: tat-swagger
uri: http://localhost:8085
predicates:
- Path=/v2/api-docs
- Query=group, tat-tasks
- id: im
uri: http://localhost:8086
predicates:
- Path=/im/**
filters:
- StripPrefix=1
- id: im-swagger
uri: http://localhost:8086
predicates:
- Path=/v2/api-docs
- Query=group, im-tasks
- id: ktr-api
uri: http://localhost:8445
predicates:
- Path=/ktr-api/**
filters:
- StripPrefix=1
- id: ktr-swagger
uri: http://localhost:8445
predicates:
- Path=/v3/api-docs
- Query=group, ktr-tasks
NOTE: It throws the error instantly.
I found the problem. I had to use https://localhost:8445 instead of http://localhost:8445
I was expecting a different error message in this case, so it didn't even occur to me that this was the problem.
What I can highly recommend to everyone in this case is that if you can ssh into the given server, try to start a get request from the console directly to the server that you would call via the gateway.
This is how I found out that the problem is not with the gateway at all.