drewzboto / grunt-connect-proxy

Grunt Connect support for proxying API calls during development
MIT License
424 stars 122 forks source link

Proxy error: ECONNRESET while proxying https to https #141

Open drudkiewicz opened 8 years ago

drudkiewicz commented 8 years ago

I'm forwarding HTTPS to HTTPS on 2 different ports. I tried saying https:true and secure:false with no luck as well. There is no breaking change stated in the changelog for those versions.

Using version 0.1.10 the following configuration works Using any newer version is broken with Proxy error

connect: {
      options: {
        port: process.env.PORT || 9001,
        hostname: process.env.HOSTNAME || '0.0.0.0',
        livereload: 35730,
        protocol: 'https'
      },
      proxies: [
        {
          context: '/api',
          host: process.env.PROXY_HOST || '0.0.0.0',
          port: process.env.PROXY_PORT || 9000,
          ws: true
        },
}
jhubble commented 8 years ago

I am seeing a similar connection reset message when proxying http to https. However, this is fixed by forcing the github version rather than the npm version: npm install git+https://github.com/drewzboto/grunt-connect-proxy.git --save-dev

brian-slate commented 8 years ago

Same. npm install git+https://github.com/drewzboto/grunt-connect-proxy.git --save-dev Fixed it for me too.

linlinlinlin commented 8 years ago

I have similar error message after upgrade grunt-connect-proxy from 0.1.10 to 0.2.0 My Gruntfile.js setting as following:

    // The actual grunt server settings
    connect: {
      proxies: [
        {
          context: '/api',
          host: '127.0.0.1',
          port: 5001,
          https: true,
          protocol: 'https',
          changeOrigin: false
        },
        {
          context: '/repository',
          host: '127.0.0.1',
          port: 5000,
          https: false,
          changeOrigin: false
        }
      ],
      options: {
        port: 9000,
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: false,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ],
          port: 9000,
          middleware: function (connect) {
            return [
              proxySnippet,
              serveStatic(require('path').resolve('app'))
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          base: '<%= yeoman.dist %>'
        }
      }
    },

How can I fix this issue?

zbindenren commented 7 years ago

Same issue here.

heppy83 commented 7 years ago

Same for me. npm install git+https://github.com/drewzboto/grunt-connect-proxy.git --save-dev fixed the issue.

It would be great if the NPM version too was working as the git one