Fixes

How to fix error occurred while trying to proxy request

  proxy: {

    "*": "http://[::1]:8081"

    // "secure": false,

    // "changeOrigin": true

  }

},

According to users, it’s crucial that you add [::1] in order to fix this problem, so be sure to try that.


4. Modify the hosts file

  1. Open the hosts file. Keep in mind that this file is protected, so be sure to check our guide on how to properly edit hosts file on Windows 10.
  2. Now add the following line to the hosts file:
    127.0.0.1 localhost

  3. Save changes and check if the problem is resolved.

5. Remove body-parser

remove parser error occurred while trying to proxy request

Many users reported that they fixed this issue simply by removing express body-parser middleware before HPM.

After doing that, the issue was completely resolved, so be sure to try that.


6. Add a header in the client proxy

add a header error occurred while trying to proxy request
  1. Open your code.
  2. Modify it like this:

module.exports = function(app) {

    app.use(proxy('/api', {

        target: 'http://127.0.0.1:8080/',

        headers: {

            "Connection": "keep-alive"

        },

    }));

};

Error occurred while trying to proxy request message can cause a lot of trouble, but hopefully, you should be able to fix it using one of our solutions.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button