Skip to content

devServer proxy option as string not working as expected #2514

Open
@ksmithut

Description

@ksmithut

Version

3.0.3

Reproduction link

https://github.com/ksmithut/vue-devserver-proxy-test

Node and OS info

Node v10.10.0 / yarn 1.9.4 / macOS 10.13.6

Steps to reproduce

Install Dependencies

yarn

Start server(s)

yarn start.dev # will start the vue dev server as well as another server which should be proxied to.

Make Requests

  1. Go to http://localhost:8080, will show the default vue page. Expected
  2. Go to http://localhost:3001/meow, will show mix . Expected
  3. Go to http://localhost:8080/meow, will show a blank page with the "home" and "about" links at the top. Not Expected

What is expected?

It was expected based on this documentation that setting a string for the "devServer.proxy" option would proxy all not-known requests to the configured proxy in vue.config.js, and a call to http://localhost:8080/meow would be the same result as http://localhost:3001/meow.

What is actually happening?

The request is not being proxied to the configured proxy server per the docs.


If the specific paths are configured in the proxy object, it seems to work fine.

Also, perhaps this is due to the "history" mode being used for the router, but it would be nice to have some sort of workaround as it doesn't mimic production behavior. I also understand I need to setup my server to send all non-matched paths to the built index.html, but I wasn't going to put in that effort unless I could get the proxy to work.

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