Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack dev server proxy doesn't work well with start-server-and-start #163

Open
rodoabad opened this issue Apr 18, 2019 · 3 comments
Open

Comments

@rodoabad
Copy link

Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue.

Is this a bug report or a feature request?

If this is a bug report, please provide as much info as possible

  • version - 1.7.13
  • platform - Mac
  • expected behavior - no errors
  • actual behavior - missing request headers

Assume you are running two servers - web and api

Web:8080
Api: 8000

Web proxies * at 8000.

config.devServer.proxy = {
    '**': {
        bypass(request) {
            if (request.headers.accept.indexOf('html') !== -1) {
                return '/index.html';
            }

            return false;
        },
        target: 'http://localhost:8000'
    }
};
    "cypress:run": "cypress run",
    "start:server": "npx foo --type server",
    "start:api": "npx foo -- type api",
    "start:server-with-api": "start-test start:api 8000?url=api start:server",
    "test:acceptance": "start-test server-with-api http-get://localhost:5555 cypress:run",

When checking for server, request header is undefined and cypress:run cannot start.

@rodoabad
Copy link
Author

Anyone here able to test this out?

@rodoabad rodoabad changed the title webpack dev server proxy doesn't work well with start-serer-and-start webpack dev server proxy doesn't work well with start-server-and-start May 16, 2019
@iamgollum
Copy link

Working on a similar issue now with CRA starter and proxy.
I am getting a different error:

Proxy error: Could not proxy request / from localhost:3000 to http://localhost:3001.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).

In package,json

"proxy": "http://localhost:3001",
....
  "test:acceptance": "start-server-and-test start:cli http://localhost:3000 cy:run",

Maybe its related but trying to figure it out.

@rajzik
Copy link

rajzik commented Jun 6, 2019

@iamgollum
When using webpack dev server use http-get:// instead of http://.

https://www.npmjs.com/package/start-server-and-test#note-for-webpack-dev-server-users

Can you replicate this issue somehow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants