Skip to content

增强proxy: 对齐webpack devServer的proxy #2868

Open
@zuoxue0119

Description

@zuoxue0119

Version

3.1.1

Node and OS info

Node 10.13.0

Steps to reproduce

proxy: [
      {
        context: '/ajax',
        target: 'https://localhost:3000',
      },
      {
        context: function (pathname, req) {
          const env = getPathnameEnv(pathname);
          return env === 'online';
        },
        target: 'https://localhost:8081',
        changeOrigin: true,
      },
]

What is expected?

增强proxy, 对齐 webpack devServer的proxy
支持proxy数组与 http-proxy-middleware中所有格式的context, 例如

proxy: [
      {
        context: '/ajax',
        target: 'https://localhost:3000',
      },
      {
        context: function (pathname, req) {
          const env = getPathnameEnv(pathname);
          return env === 'online';
        },
        target: 'https://localhost:8081',
        changeOrigin: true,
      },
]

What is actually happening?

目前不支持数组类型的proxy, 也不支持自定义函数的context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions