转发:/对于不与SPA / Angular合作的Zuul路线

时间:2018-01-24 10:24:05

标签: java spring angular spring-boot netflix-zuul

我有一个用于API的API网关和配置的UI。

zuul:
    ignored-patterns: /health
    routes:
        fbresource:
            path: /fb/**
            url: http://localhost:8081/
        angularresource:
            path: /**
            url: http://localhost:4200/bpproxy/

本地化很好,但是对于集中开发,这将通过openshift进行部署,角度部分正在编译并放入静态目录。

为此,我们覆盖angularresource部分,如:

angularresource:
    path: /**
    url: forward:/

如果加载http://example.com/bpproxy/已加载角度,但如果我尝试通过网址直接获取组件(http://examplel.com/bpproxy/welcome),则表示:

2018-01-24 11:18:07.195 ERROR 10236 --- [io-8080-exec-10] o.s.boot.web.support.ErrorPageFilter : Cannot forward to error page for request [/welcome] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

将配置更改为:

angularresource:
    path: /asd
    url: http://localhost:4200/bpproxy/

路由现在不匹配,Spring提供静态内容。