gruntjs / grunt-contrib-connect

Start a static web server.
http://gruntjs.com
MIT License
714 stars 146 forks source link

Proxy to a https gives error 500. How to debug? #176

Closed andreicristianpetcu closed 9 years ago

andreicristianpetcu commented 9 years ago

Hi, I want to proxy http://localhost:9000/images and http://localhost:9000/rest to https://remotehost/images and https://remotehost/rest but I get error 500 for both. What am I doing wrong? How to debug this? Here is my config:

        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;
                    }
                }
            },

I tried to debug this running grunt serve --debug bug I get no extra information about why I get this error. Thank you!

sindresorhus commented 9 years ago

Support questions are better asked on StackOverflow: http://stackoverflow.com/questions/tagged/gruntjs Paste in the link to the question here so others can follow ;)

andreicristianpetcu commented 9 years ago

Thank you http://stackoverflow.com/questions/29824832/grunt-contrib-connect-proxy-gives-error-500-how-to-debug