tnblog
首页
视频
资源
登录

Angular使用Proxy

4622人阅读 2019/11/5 10:35 总访问:2603295 评论:0 收藏:0 手机
分类: .net后台框架

Multiple entries

If you need to proxy multiple entries to the same target define the configuration in proxy.conf.js instead of proxy.conf.json e.g.

const PROXY_CONFIG = [
    {
        context: [
            "/my",
            "/many",
            "/endpoints",
            "/i",
            "/need",
            "/to",
            "/proxy"
        ],
        target: "http://localhost:3000",
        secure: false
    }
]module.exports = PROXY_CONFIG;

Make sure to point to the right file (.js instead of .json):

"architect": {  
        "serve": {    
        "builder": "@angular-devkit/build-angular:dev-server",
        "options": 
        {      
            "browserTarget": "your-application-name:build",
            "proxyConfig": "proxy.conf.js"
        },
export const environment = {
  production: false,
  apiUrlBase:'/api'
};

官方uri:https://github.com/angular/angular-cli/wiki/stories-proxy


欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739

评价
这一世以无限游戏为使命!
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术