Tag Archives: Gateway Error

[Solved] gateway Error: reactor.core.Exceptions$ErrorCallbackNotImplemented

The production environment is fine, but suddenly all front-end requests are cross-domain and the requests are 500. gateway reports an error.
reactor.core.Exceptions$ErrorCallbackNotImplemented:java.lang.IndexOutOfBoundsException: Index: 0, Size: 0. All interfaces are reported.
The reason is that the gateway also integrates with springboot-admin, which opens the actuator endpoint of the application, leading to a code injection attack

Solution: Use nginx to intercept the path directly, add the following configuration to conf, and reload nginx.

location /actuator {
    return 404;
}

 

Gateway Error: Cannot resolve org.springframework.cloud:spring-cloud-starter-gateway:unknown

Reason: there is no version with the same version as springboot, so you need to add your own version model
eg:

<?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 https://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.3.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>dtestgateway</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>dtestgateway</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
<!--        <dependency>-->
<!--            <groupId>org.springframework.boot</groupId>-->
<!--            <artifactId>spring-boot-starter-web</artifactId>-->
<!--        </dependency>-->

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
            <version>3.0.1</version>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>