Skip to content

Request uri rewrite in proxy settings? #344

@adiachenko

Description

@adiachenko

Consider the config below. By default webpack-dev-server will proxy /api/ requests to http://api.io/api/. I need to make it pass /api/ requests to http://api.io. I there any way to achieve this? I tried to look into into bypass and rewrite settings on proxyOptions but i seems that they aren't suited for this particular use case. For example, if I directly remove /api/ in bypass function it will just pass request to the next middleware in webpack-dev-server instead of requesting target.

  devServer: {
    port: 80,
    proxy: {
      '/api/*': {
        host: 'api.io',
        target: 'http://192.168.33.13/'
      }
    }
  }

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