var argv, http, url;
argv = require("optimist").default("port", 80).alias("p", "port").argv;
http = require("http");
url = require("url");
http.createServer(function (req, res) {
    var parsedUrl, proxyUrl;
    // Enable Cross-Origin Resource Sharing (CORS).
    res.setHeader("Access-Control-Allow-Origin", "*");
    res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
    parsedUrl = url.parse(req.url, true);
    if (parsedUrl.query.hasOwnProperty("url")) {
        proxyUrl = url.parse(parsedUrl.query.url);
        var proxyOptions = {
            "host": proxyUrl.host,
            "port": proxyUrl.port || 80,
            "path": proxyUrl.pathname,
            "method": req.method,
            "headers": {}
        };
        // Copy some useful HTTP headers.
        if (req.headers.hasOwnProperty("accept")) proxyOptions.headers["Accept"] = req.headers["accept"];
        // url.parse does not parse localhost correctly.
        if (proxyOptions.host.indexOf("localhost") !== -1) {
            proxyOptions.host = proxyOptions.host.split(":")[0];
        }
        // url.parse does not parse complex pathnames correctly.
        proxyOptions.path += req.url.split(proxyOptions.path)[1];
        var proxyReq = http.request(proxyOptions, function (proxyRes) {
            var resHeaders;
            resHeaders = {};
            if (proxyRes.headers.hasOwnProperty("content-type")) resHeaders["Content-Type"] = proxyRes.headers["content-type"];
            res.writeHead(200, resHeaders);
            // end() is called on res when proxyRes emits end.
            proxyRes.pipe(res);
        });
        proxyReq.on("error", function (e) {
            res.writeHead(500);
            res.end("Captain, we crashed: " + e.code + "\n");
        });
        proxyReq.end();
    } else {
        res.writeHead(400);
        res.end("\"url\", did you pass it?\n");
    }
}).listen(argv.port);
console.log("Server running at http://127.0.0.1:" + argv.port + "/");

@@ -390,24 +390,91 @@
  OPTIONS%22);%0A
+    res.setHeader(%22Access-Control-Allow-Headers%22, %22Content-Type%22);%0A
     parsedUr
@@ -962,24 +962,148 @@
 %5B%22accept%22%5D;%0A
+        if (req.headers.hasOwnProperty(%22content-type%22)) proxyOptions.headers%5B%22Content-Type%22%5D = req.headers%5B%22content-type%22%5D;%0A
         // u
@@ -1980,24 +1980,74 @@
         
+// Pipe body into proxy request.%0A        req.pipe(
 proxyReq
 .end();%0A
@@ -2038,21 +2038,16 @@
 proxyReq
-.end(
 );%0A    %7D

Support payload and Content-Type header.