reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response,springboot2.1.6
See original GitHub issuespringboot2.1.6.RELEASE and Spring Cloud Greenwich.SR1
application.yml
spring: application: name: gateway-service cloud: gateway: default-filters: - StripPrefix=1 routes: - id: provider_api_route uri: lb://provider-service predicates: - Path=/web/** discovery: locator: enabled: true consul: enabled: true discovery: instanceId: ${spring.application.name}😒{vcap.application.instance_id:${spring.application.instance_id:${random.value}}} #prefer-ip-address: true retry: initial-interval: 10 multiplier: 1 max-interval: 30000 max-attempts: 15
my pom.xml
` <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> <relativePath/> </parent> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> <description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</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>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
`Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (11 by maintainers)
@creaton60 have you tried to set the maxIdleTime property?
AFAIR by default, it is NULL so your connection will be waiting forever without closing it on the gateway and it may be closed on server site.
https://blog.csdn.net/rickiyeat/article/details/107900585