drewzboto / grunt-connect-proxy

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

Change Request Headers #126

Open ghost opened 8 years ago

ghost commented 8 years ago

I have a problem with proxy configuration. Not matter what I cannot change request headers. Request if always send with original headers.

// Connect task
connect: {
    server: {
        options: {
            debug: true,
            protocol: '<%= settings.server.protocol %>',
            hostname: '<%= settings.server.host %>',
            port: '<%= settings.server.port %>',
            open: '<%= settings.server.protocol %>://<%= settings.server.host %>:<%= settings.server.port %>',
            middleware: function(connect, options, defaultMiddleware) {
                var proxy = require('grunt-connect-proxy/lib/utils').proxyRequest;
                return [proxy].concat(defaultMiddleware);
            }
        },
        proxies: [{
            context: ['/test1', '/test2'],
            host: 'test.something.com',
            headers: {
                Host: 'test.something.com'
            }
        }]
    }
}