Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.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
Java 如何将SpringCloudZuul服务器设置为代理服务器_Java_Spring_Spring Boot_Spring Cloud - Fatal编程技术网

Java 如何将SpringCloudZuul服务器设置为代理服务器

Java 如何将SpringCloudZuul服务器设置为代理服务器,java,spring,spring-boot,spring-cloud,Java,Spring,Spring Boot,Spring Cloud,我尝试使用SpringCloudZuul服务器作为代理服务器,但当我访问默认上下文时,它不会重定向到url目标 例如: @EnableZuulServer @SpringBootApplication public class ZuulServerApp { private static final Logger LOGGER = LoggerFactory.getLogger(ZuulServerApp.class); public static void main(Str

我尝试使用SpringCloudZuul服务器作为代理服务器,但当我访问默认上下文时,它不会重定向到url目标

例如:

@EnableZuulServer
@SpringBootApplication
public class ZuulServerApp {

    private static final Logger LOGGER = LoggerFactory.getLogger(ZuulServerApp.class);

    public static void main(String[] args) throws Exception {
        // Start Spring application
        SpringApplication.run(ZuulServerApp.class, args);

        LOGGER.warn("Startup completed and listening");
    }
}
应用程序属性

###################
### Spring Boot ###
###################
server.port=8765
spring.main.show-banner=false

zuul.routes.resource.path=/**
zuul.routes.resource.url=http://www.uol.com.br
zuul.routes.resource.stripPrefix=true
是否缺少任何配置

http://localhost:8765/ does not redirect to http://www.uol.com.br

@EnableZuulProxy
添加到您的
ZuulServerApp

您还可以在不使用代理的情况下运行Zuul服务器,或者打开 如果使用代理平台,则有选择地使用代理平台的部分
@EnableZuulServer
(而不是
@EnableZuulProxy
)。你要什么豆子 添加到将安装的应用程序类型
zuumFilter
自动,就像使用
@EnableZuulProxy
一样,但不使用任何 正在自动添加的代理筛选器

在这种情况下,进入Zuul服务器的路由仍然由 正在配置
zuul.routes.*
,但没有服务发现和 代理,因此“serviceId”和“url”设置被忽略