-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Proxy not working #694
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
Comments
I'm just guessing here, but some things to try:
Are you using the CLI or Node.js API? |
Tried all your suggestions, didn't work. I'm using the Node.js API |
Can you show me how you're using the Node.js API? Note that the |
I'm using const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const webpackConfig = require('./webpack.config');
gulp.task("frontend-server", (cb) => {
new WebpackDevServer(webpack(webpackConfig))
.listen(8077, "localhost", (err) => {
if (err) throw new gutil.PluginError("webpack-dev-server", err);
cb();
});
}); |
Ah, like I thought, the devServer options don't get included. Change this:
I'm assuming |
That's IT. It's working now. Thanks a lot SpeceK33z |
I'm submitting a bug report
Versions
webpack: 1.12.13
webpack-dev-server: 1.16.2
Environment
Node v6.9.1
macOS latest
Chrome 54.0.2840.71 (64-bit)
Current behavior
when firing an AJAX request:
GET http://localhost:8077/api/posts
, the webpack-dev-server proxy should proxy this request tohttp://localhost:9000/api/posts
. Yet the request never reaches the server and the browser (Chrome) in the console reports a 404 not foundhttp://localhost:8077/api/posts
.Chrome request info
general
Request URL:http://localhost:8077/api/posts
Request Method:GET
Status Code:404 Not Found
Remote Address:127.0.0.1:8077
response headers
Connection:keep-alive
Content-Length:34
Content-Type:text/html; charset=utf-8
Date:Tue, 15 Nov 2016 12:58:27 GMT
X-Content-Type-Options:nosniff
X-Powered-By:Express
response
Cannot GET /api/posts
I directly tested the endpoint
GET http://localhost:9000/api/posts
and it works correctly.Expected behavior
The webpack-dev-server proxies
GET http://localhost:8077/api/posts
to my backend express server endpoint athttp://localhost:9000/api/posts
.Code
the devServer section in my
webpack.config.js
Related issues
I've searched through other issues (#458, #424), and tried all suggestions. Yet it just won't work.
I've also tried other combinations but whatever I do, it won't work.
The text was updated successfully, but these errors were encountered: