Node.js grunt contrib connect代理给出错误500。如何调试?

Node.js grunt contrib connect代理给出错误500。如何调试?,node.js,https,gruntjs,Node.js,Https,Gruntjs,我想代理和到,但两者都有错误500。我做错了什么?如何调试这个? 这是我的配置: connect: { options: { port: 9000, // Change this to '0.0.0.0' to access the server from outside. hostname: 'localhost', livereload: 35729

我想代理和到,但两者都有错误500。我做错了什么?如何调试这个? 这是我的配置:

        connect: {
        options: {
            port: 9000,
            // Change this to '0.0.0.0' to access the server from outside.
            hostname: 'localhost',
            livereload: 35729
        },
        proxies: [
            {
                context: '/images',
                host: remotehost,
                port: 443,
                https: true,
                changeOrigin: true,
                xforward: false,
                rejectUnauthorized: false
            }
        ],
        livereload: {
            options: {
                open: true,
                base: [
                    '.tmp',
                    '<%= yeoman.app %>'
                ],
                middleware: function (connect, options) {
                    if (!Array.isArray(options.base)) {
                        options.base = [options.base];
                    }

                    // Setup the proxy
                    var middlewares = [require('grunt-connect-proxy/lib/utils').proxyRequest];

                    // Serve static files.
                    options.base.forEach(function(base) {
                        middlewares.push(connect.static(base));
                    });

                    // Make directory browse-able.
                    var directory = options.directory || options.base[options.base.length - 1];
                    middlewares.push(connect.directory(directory));

                    return middlewares;
                }
            }
        },
连接:{
选项:{
港口:9000,
//将此更改为“0.0.0.0”以从外部访问服务器。
主机名:“localhost”,
利弗雷罗德:35729
},
代理:[
{
上下文:'/images',
主机:remotehost,
港口:443,
https:是的,
来源:对,
X前进:错,
拒绝:错误
}
],
利弗雷罗德:{
选项:{
开放:是的,
基数:[
“.tmp”,
''
],
中间件:功能(连接、选项){
if(!Array.isArray(options.base)){
options.base=[options.base];
}
//设置代理
var middleware=[require('grunt-connect-proxy/lib/utils').proxyRequest];
//提供静态文件。
options.base.forEach(函数(基){
中间件。推送(连接。静态(基础));
});
//使目录可浏览。
var directory=options.directory | | options.base[options.base.length-1];
push(connect.directory(directory));
退货;
}
}
},
我试图调试这个正在运行的grunt服务--debug bug我没有得到关于为什么会出现这个错误的额外信息。 非常感谢。

grunt connect代理似乎已被放弃:请参阅

我使用grunt-connect-proxy2以以下方式运行成功配置:

{ /* package.json */
  "name": "grunt-connect-sample",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {},
  "devDependencies": {
    "grunt": "^1.0.1",
    "grunt-connect-proxy2": "^2.0.0",
    "grunt-contrib-connect": "^1.0.2",
    "grunt-contrib-jshint": "^1.1.0",
    "grunt-contrib-watch": "^1.0.0"
  }
}
然后
grunfile.js
是:

module.exports = function (grunt) {

    grunt.initConfig({
        jshint: {
            files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
            options: {
                globals: {
                    jQuery: true
                }
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint']
        },

        connect: {
            server: {
                options: {
                    port: 9000,
                    base: 'src/webroot',
                    keepalive: true,
                    middleware: function (connect, options, defaultMiddleware) {
                        var proxy = require('grunt-connect-proxy2/lib/utils').proxyRequest;
                        return [
                            // Include the proxy first
                            proxy
                        ].concat(defaultMiddleware);
                    }
                },
                proxies: [
                    {
                        context: '/google',
                        host: 'www.google.it',
                        port: 443,
                        https: true,
                        rewrite: {
                            '^/google': ''
                        }
                    }
                ]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-connect-proxy2');

    grunt.registerTask('default', ['jshint', 'configureProxies:server', 'connect:server']);

};
module.exports=函数(grunt){
grunt.initConfig({
jshint:{
文件:['grunfile.js','src/***/.js','test/***/.js'],
选项:{
全球:{
jQuery:true
}
}
},
观察:{
文件:[''],
任务:['jshint']
},
连接:{
服务器:{
选项:{
港口:9000,
base:'src/webroot',
基帕利夫:是的,
中间件:功能(连接、选项、默认中间件){
var proxy=require('grunt-connect-proxy2/lib/utils')。proxyRequest;
返回[
//首先包括代理
代理
].concat(默认值);
}
},
代理:[
{
上下文:'/google',
主持人:“www.google.it”,
港口:443,
https:是的,
重写:{
“^/谷歌”:”
}
}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks(“grunt-contrib-watch”);
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-connect-proxy2');
registerTask('default',['jshint','configureProxies:server','connect:server']);
};

那么您就无法访问
http://localhost:9000/google

您解决了这个问题吗?我想我更新了NodeJS或Grunt…这似乎不适用于自签名证书。