Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Spring Zuul重定向不适用于外部url_Spring Boot_Netflix Zuul_Spring Rest - Fatal编程技术网

Spring boot Spring Zuul重定向不适用于外部url

Spring boot Spring Zuul重定向不适用于外部url,spring-boot,netflix-zuul,spring-rest,Spring Boot,Netflix Zuul,Spring Rest,你能告诉我为什么mu Zuul重定向不起作用吗 应用程序属性 spring.application.name=netflix-zuul-api-gateway-server management.endpoints.web.exposure.include=* management.endpoint.routes.enabled=true management.endpoint.filters.enabled=true server.port=8765 application.yml

你能告诉我为什么mu Zuul重定向不起作用吗

应用程序属性

    spring.application.name=netflix-zuul-api-gateway-server
management.endpoints.web.exposure.include=*
management.endpoint.routes.enabled=true
management.endpoint.filters.enabled=true
server.port=8765
application.yml

   zuul:
  routes:
    google:
      path: /google/**
      url: https://www.google.com/
      stripPrefix: true
bootstrap.properties

    spring.application.name=netflix-zuul-api-gateway-server
management.endpoints.web.exposure.include=*
management.endpoint.routes.enabled=true
management.endpoint.filters.enabled=true
server.port=8765
NetflixZuulApiGatewayServerApplication

@SpringBootApplication
public class NetflixZuulApiGatewayServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(NetflixZuulApiGatewayServerApplication.class, args);
    }
    
    @Bean
    public Sampler defaultSampler(){
        return Sampler.ALWAYS_SAMPLE;
    }
左洛金滤波器

@Component
public class ZuulLoggingFilter extends ZuulFilter{

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() {
        HttpServletRequest request = 
                RequestContext.getCurrentContext().getRequest();
        logger.info("request -> {} request uri -> {}", 
                request, request.getRequestURI());
        return null;
    }

    @Override
    public String filterType() {
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 1;
    }
}
版本:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
获得404http://localhost:8765/google/try