我正在开发一个SpringBoot Reaction全堆栈应用程序.我使用了Spring云网关作为我的API网关,将请求路由到upstream 微服务.此外,我的Reaction SPA也在Spring云网关上运行.
当我运行Spring云网关应用程序时,我能够加载前端图形用户界面.
当我在图形用户界面中导航时,它工作正常
但当我刷新时,我收到白色标签错误.
我将不得不再次加载登录页,并只通过图形用户界面导航.
我已try 按如下方式配置网关应用程序,但它不起作用.
@Bean
public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer(){
return factory -> {
ErrorPage errorPage = new ErrorPage(HttpStatus.NOT_FOUND,"/index.html");
factory.addErrorPages(errorPage);
};
}
package com.xpense.service;
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
@Component
public class ErrorPageConfig implements ErrorPageRegistrar {
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND,"/index.html"));
}
}
下面是路由配置
server:
port: 10443
spring:
application:
name: xpense-api-gateway
cloud:
gateway:
routes:
- id: xpense-service
uri: http://localhost:18080/
predicates:
- Path=/xpense/service/**
请帮帮忙