Skip to content

Webpack and devServer Proxy not working as per the example in the Documentation #17908

Open
@pafr-zyata

Description

@pafr-zyata

What happened?

I setup a new quasar project using webpack.

I then added to the quasar.config.js the following:

devServer: {
  proxy: {
    // proxy all requests starting with /api to jsonplaceholder
    '/api': {
      target: 'http://some.api.target.com:7070',
      changeOrigin: true,
      pathRewrite: {
        '^/api': ''
      }
    }
  }
}

Then trying to run the app with quasar dev I get compile errors which state that webPack devServer proxy propertie expects the proxy property to be an array.

After looking at the webpack.devServer Documentation I switched the proxy statement to:

devServer: {
  proxy: [
    // proxy all requests starting with /api to jsonplaceholder
    {
      context: ["/api"],
      target: 'http://some.api.target.com:7070',
      changeOrigin: true,
      pathRewrite: {
        '^/api': ''
      }
    }
  ]
}

Then starting the app with quasar dev works, but nothing is beeing proxied.

What did you expect to happen?

I expect at least one of the configs to work, honestly I expect the config from the documentation to work.

Reproduction URL

https://example.com

How to reproduce?

Setup a new quasar project with webpack, add the devServer and proxy settings.

Flavour

Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)

Platforms/Browsers

No response

Quasar info output

Relevant log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions