Grunt Connect Proxy not sending POST Parameters

615 views Asked by At

I have an my app configured to use grunt-connect-proxy. Request reach the server and evverything is working fine apart from POST requests.

When running grunt with the verbose option set, I can see:

Proxied request: /api/data.json -> http://myProdutionDomain.com:80/beta/api/data.json

    {
      "host": "0.0.0.0:9000",
      "connection": "keep-alive",
      "content-length": "15",
      "accept": "application/json, text/plain, */*",
      "origin": "http://0.0.0.0:9000",
      "user-agent": "Mozilla/5.0 (Macintosh; ...)",
      "content-type": "application/json;charset=UTF-8",
      "referer": "http://0.0.0.0:9000/",
      "accept-encoding": "gzip,deflate,sdch",
      "accept-language": "en",
      "cookie": "some-cookie",
    }

My proxies configuration is as follows:

proxies: [
            {
                context: '/api',
                host: 'myProdutionDomain.com',
                changeOrigin: true,
                rewrite: {
                    '^/': '/beta/'
                }
            }
        ]

From Angular I just do:

$http.post(requestUrl, {'id': id});

Also tried:

request = $http.post(requestUrl, {'id': id}, {'headers': {'Content-Type': 'application/x-www-form-urlencoded'}});

Problem is the 'id' post param is never sent to the server.

Anyone has experience with this?

0

There are 0 answers