{"action":"created","issue":{"url":"https://api.github.com/repos/nodejitsu/node-http-proxy/issues/760","labels_url":"https://api.github.com/repos/nodejitsu/node-http-proxy/issues/760/labels{/name}","comments_url":"https://api.github.com/repos/nodejitsu/node-http-proxy/issues/760/comments","events_url":"https://api.github.com/repos/nodejitsu/node-http-proxy/issues/760/events","html_url":"https://github.com/nodejitsu/node-http-proxy/issues/760","id":53256649,"number":760,"title":"Unable to proxy multi-part form","user":{"login":"todkap","id":10372862,"avatar_url":"https://avatars.githubusercontent.com/u/10372862?v=3","gravatar_id":"","url":"https://api.github.com/users/todkap","html_url":"https://github.com/todkap","followers_url":"https://api.github.com/users/todkap/followers","following_url":"https://api.github.com/users/todkap/following{/other_user}","gists_url":"https://api.github.com/users/todkap/gists{/gist_id}","starred_url":"https://api.github.com/users/todkap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/todkap/subscriptions","organizations_url":"https://api.github.com/users/todkap/orgs","repos_url":"https://api.github.com/users/todkap/repos","events_url":"https://api.github.com/users/todkap/events{/privacy}","received_events_url":"https://api.github.com/users/todkap/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-01-02T15:00:06Z","updated_at":"2015-01-02T17:35:35Z","closed_at":null,"body":"Multiple attempts to proxy multi-part using both the browser and curl.  \r\n\r\nMight be something really small but cannot seem to figure it out.  The curl command sends the expect header and the browser does not.  However, both do not proxy the request.   Might be easier to see the first issue with the curl command and then narrow the issue down for the browser.\r\n\r\nCurl command\r\ncurl -v --upload-file ./cam_espn.jpg  http://127.0.0.1:3000/todkap%40us.ibm.com/cam_espn5.jpg\r\n\r\nOutput\r\ntodkapmacbookpro:bluemix_objectstorage_bug todd$ curl -v --upload-file ./cam_espn.jpg  http://127.0.0.1:3000/todkap%40us.ibm.com/cam_espn5.jpg\r\n* Hostname was NOT found in DNS cache\r\n*   Trying 127.0.0.1...\r\n* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)\r\n> PUT /todkap%40us.ibm.com/cam_espn5.jpg HTTP/1.1\r\n> User-Agent: curl/7.37.1\r\n> Host: 127.0.0.1:3000\r\n> Accept: */*\r\n> Content-Length: 197616\r\n> Expect: 100-continue\r\n> \r\n< HTTP/1.1 100 Continue\r\n< HTTP/1.1 100 Continue\r\n* We are completely uploaded and fine\r\n< HTTP/1.1 404 Not Found\r\n< X-Powered-By: Express\r\n< SkipProxyWeb: true\r\n< X-Content-Type-Options: nosniff\r\n< Content-Type: text/html; charset=utf-8\r\n< Content-Length: 46\r\n< Date: Fri, 02 Jan 2015 14:55:39 GMT\r\n< Connection: keep-alive\r\n< \r\nCannot PUT /todkap%40us.ibm.com/cam_espn5.jpg\r\n* Connection #0 to host 127.0.0.1 left intact\r\n\r\nNode script\r\ntodkapmacbookpro:bluemix_objectstorage_bug todd$ cat app.js \r\n\r\n```js\r\nvar https  = require('https');\r\nvar url = require(\"url\");\r\nvar express = require('express');\r\nvar request = require(\"request\");\r\nvar httpProxy = require(\"http-proxy\");\r\nvar app = express()\r\n\r\nvar multer  = require('multer')\r\napp.use(multer({ inMemory: true}))\r\n\r\napp.use(require('connect-restreamer')());\r\n\r\n//\r\n// Create a proxy server with custom application logic\r\n//\r\nvar proxy = httpProxy.createProxyServer({});\r\n\r\n\r\n// Append Swift security token to all proxied outbound calls\r\nproxy.on('proxyReq', function(proxiedReq, req, res, options) {\r\n\tconsole.log('RAW request headers from client', JSON.stringify(req.headers, true, 2));\r\n\tif(!req.header('expect')){\r\n  \t\tproxiedReq.setHeader('TestHeader', foo);\r\n\r\n  \t}else{\r\n  \t\tres.setHeader(\"ProxyRequestEventFoundExpect\", \"true\");\r\n  \t}\r\n});\r\n\r\n\r\n\r\n// Proxy logic..\r\napp.use(function (clientRequest, clientResponse, next){\r\n\tconsole.log('Logging inbound request %s %s', clientRequest.method, clientRequest.url);\r\n\tconsole.log(\"request body\", clientRequest.body);\r\n\tconsole.log(\"request files\", clientRequest.files);\r\n\t\r\n\tvar proxyURL = \"www.google.com\" ;\r\n\r\n\tvar options = {target : proxyURL};\r\n\tif(!clientRequest.header('expect')){\r\n\t\tproxy.web(\tclientRequest, clientResponse, options  );\r\n\t}else{\r\n\t\tconsole.log(\"request had an expect in it... skip proxy call\");\r\n\t\tclientResponse.writeContinue();\r\n  \t\tclientResponse.setHeader(\"SkipProxyWeb\", \"true\");\r\n\t\tnext();\r\n\t}\r\n})\r\n\r\n//\r\n// // Listen for the `proxyRes` event on `proxy`.\r\n// //\r\nproxy.on('proxyRes', function (proxyRes, req, res) {\r\n\tconsole.log(\"attempting to log the response in proxyRes\");\r\n  \tconsole.log('RAW Response from the target', JSON.stringify(proxyRes.headers, true, 2));\r\n});\r\n\r\nvar server = app.listen(3000, function () {\r\n\tvar host = server.address().address\r\n\tvar port = server.address().port\r\n\tconsole.log('Example app listening at http://%s:%s', host, port)\r\n})\r\n```\r\nServer side log\r\nLogging inbound request PUT /todkap%40us.ibm.com/cam_espn5.jpg\r\nrequest body {}\r\nrequest files {}\r\nrequest had an expect in it... skip proxy call\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nodejitsu/node-http-proxy/issues/comments/68544980","html_url":"https://github.com/nodejitsu/node-http-proxy/issues/760#issuecomment-68544980","issue_url":"https://api.github.com/repos/nodejitsu/node-http-proxy/issues/760","id":68544980,"user":{"login":"jcrugzz","id":592149,"avatar_url":"https://avatars.githubusercontent.com/u/592149?v=3","gravatar_id":"","url":"https://api.github.com/users/jcrugzz","html_url":"https://github.com/jcrugzz","followers_url":"https://api.github.com/users/jcrugzz/followers","following_url":"https://api.github.com/users/jcrugzz/following{/other_user}","gists_url":"https://api.github.com/users/jcrugzz/gists{/gist_id}","starred_url":"https://api.github.com/users/jcrugzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcrugzz/subscriptions","organizations_url":"https://api.github.com/users/jcrugzz/orgs","repos_url":"https://api.github.com/users/jcrugzz/repos","events_url":"https://api.github.com/users/jcrugzz/events{/privacy}","received_events_url":"https://api.github.com/users/jcrugzz/received_events","type":"User","site_admin":false},"created_at":"2015-01-02T17:35:35Z","updated_at":"2015-01-02T17:35:35Z","body":"Also we do not have multi-part form tests (though I would love to!) But in this case it shouldn't make a difference as we will proxy any binary data that comes down the pipe as we just simply make a new request and use the `.pipe()` method internally. It should be because of the writeContinue dance as we do not handle specially handle expect 100 requests innately. "}}