Java.io.IOException: Failed to get API configuration with status: 404 when called from web server

So, I have an appappine webapp that includes cloud endpoints deployed locally on port 8888.

An error message in the header occurs when starting our webpack-dev-server , which runs on port 3000 and proxies all requests starting from /_ah/api/*before http://localhost:8888. The exact console error is as follows:

enter image description here

Strange, when I open this url in another tab and switch the port to 8888, the request arrives, and the webpack-dev server can also proxy server requests from now on.

Most of the other releases that I read in this section suggested setting up appengine in gradle as follows:

httpPort = 8888
httpAddress = "0.0.0.0";

However, I have already done this so that there does not seem to be a problem.

My relevant webpack configuration is as follows:

module.exports = webpackMerge(commonConfig, {
  ...
  output: {
    ...
    publicPath: 'http://localhost:3000/'
  },
  devServer: {
    port: 3000,
    open: true,
    proxy: {
      '/_ah/api/*': 'http://localhost:8888/'
    }
  }
});
+4
source share
1 answer

Some servers do not work properly without changeOrigin: true. You can use it as follows:

proxy: {
    '/_ah/api/*': {
        target: 'http://localhost:8888/',
        changeOrigin: true,
        secure: false
    }
}

If this does not work, should the proxy path ( /_ah/api/) in the request be included ? You can try if the path is ignored:

proxy: {
    '/_ah/api/*': {
        target: 'http://localhost:8888/',
        ignorePath: true
    }
}

And if this does not work, I will try to remove the last part of the proxy channel: /_ah/api/*to /_ah/api. This should do the same, but the first one is out of date.

+2
source

Source: https://habr.com/ru/post/1656732/


All Articles