{"action":"created","issue":{"url":"https://api.github.com/repos/stormpath/express-stormpath/issues/180","labels_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/180/comments","events_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/180/events","html_url":"https://github.com/stormpath/express-stormpath/issues/180","id":114553054,"number":180,"title":"Bug: Stormpath crashing app on POST to an unguarded api","user":{"login":"baer","id":940667,"avatar_url":"https://avatars.githubusercontent.com/u/940667?v=3","gravatar_id":"","url":"https://api.github.com/users/baer","html_url":"https://github.com/baer","followers_url":"https://api.github.com/users/baer/followers","following_url":"https://api.github.com/users/baer/following{/other_user}","gists_url":"https://api.github.com/users/baer/gists{/gist_id}","starred_url":"https://api.github.com/users/baer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baer/subscriptions","organizations_url":"https://api.github.com/users/baer/orgs","repos_url":"https://api.github.com/users/baer/repos","events_url":"https://api.github.com/users/baer/events{/privacy}","received_events_url":"https://api.github.com/users/baer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-02T09:04:01Z","updated_at":"2015-11-02T18:42:53Z","closed_at":null,"body":"express-stormpath is crashing my application when I `POST` to a route in express regardless of whether or not it is protected by`stormpath.loginRequired`. `GET` requests work just fine. Removing the `app.use` in my express config fixes the problem. \r\n\r\nI've been trying to diagnose the issue and I'm coming up empty handed. I will keep looking but in the mean time the below is how to replicate the issue along with a long trace. \r\n\r\n```js\r\n    $.ajax({\r\n      url: 'api/aRouteToPostTo',\r\n      type: 'POST',\r\n      data: savableOrder,\r\n      dataType: 'json'\r\n    });\r\n```\r\n\r\n```js\r\n  app.all('/api/*', function(req, res) {\r\n    req.url = req.url.slice(5, req.url.length);\r\n    req.url = '/myApiRootUrl/' + req.url;\r\n\r\n    var auth = 'Basic ' + new Buffer(config.proxyUsername + ':' + config.proxyPassword).toString('base64');\r\n    req.headers.authorization = auth;\r\n\r\n    proxy.web(req, res, {\r\n      target: 'http://' + config.proxyHost + ':' + config.proxyPort\r\n    });\r\n  });\r\n```\r\n\r\n```js\r\n  app.use(stormpath.init(app, {\r\n    website: true,\r\n    client: {\r\n      apiKey: {\r\n        id: config.stormpath.id,\r\n        secret: config.stormpath.secret\r\n      }\r\n    },\r\n    application: {\r\n      href: config.stormpath.url\r\n    },\r\n    web: {\r\n      register: {\r\n        fieldOrder: ['givenName', 'surname', 'email', 'password', 'passwordConfirm']\r\n      }\r\n    }\r\n  }));\r\n```\r\n```\r\nPOST /api/aRouteToPostTo - - ms - -\r\nError: socket hang up\r\n    at createHangUpError (_http_client.js:209:15)\r\n    at Socket.socketCloseListener (_http_client.js:241:23)\r\n    at emitOne (events.js:82:20)\r\n    at Socket.emit (events.js:169:7)\r\n    at TCP._onclose (net.js:469:12)\r\n---------------------------------------------\r\n    at Array.stream (/Users/xxxxxx/dev/stormpath-app/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:134:14)\r\n    at ProxyServer.<anonymous> (/Users/xxxxxx/dev/stormpath-app/node_modules/http-proxy/lib/http-proxy/index.js:80:21)\r\n    at /Users/xxxxxx/dev/stormpath-app/src/server/routes.js:52:11\r\n    at Layer.handle [as handle_request] (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/layer.js:95:5)\r\n    at next (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/route.js:131:13)\r\n    at next (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/route.js:125:14)\r\n    at next (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/route.js:125:14)\r\n    at next (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/route.js:125:14)\r\n    at next (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/route.js:125:14)\r\n---------------------------------------------\r\n    at Request.init (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/node_modules/request/request.js:126:10)\r\n    at new Request (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/node_modules/request/request.js:99:8)\r\n    at request (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/node_modules/request/index.js:54:11)\r\n    at RequestExecutor.executeRequest [as execute] (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/lib/ds/RequestExecutor.js:92:3)\r\n    at doRequest (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/lib/ds/DataStore.js:277:27)\r\n    at onCacheResult (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/lib/ds/DataStore.js:301:5)\r\n    at Array.<anonymous> (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/lib/cache/Cache.js:54:14)\r\n    at DisabledCache.get.DisabledCache.set.DisabledCache.delete.DisabledCache.clear.DisabledCache.size (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/lib/cache/DisabledCache.js:11:62)\r\n    at Cache.get (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/lib/cache/Cache.js:52:14)\r\n---------------------------------------------\r\n    at handleError (/Users/xxxxxx/dev/stormpath-app/node_modules/njwt/index.js:56:20)\r\n    at Verifier.verify (/Users/xxxxxx/dev/stormpath-app/node_modules/njwt/index.js:352:12)\r\n    at Object.jwtLib.verify (/Users/xxxxxx/dev/stormpath-app/node_modules/njwt/index.js:388:21)\r\n    at JwtAuthenticator.authenticate (/Users/xxxxxx/dev/stormpath-app/node_modules/stormpath/lib/jwt/jwt-authenticator.js:40:8)\r\n    at Object.module.exports [as getUser] (/Users/xxxxxx/dev/stormpath-app/node_modules/express-stormpath/lib/helpers/get-user.js:69:19)\r\n    at stormpathMiddleware (/Users/xxxxxx/dev/stormpath-app/node_modules/express-stormpath/lib/stormpath.js:92:13)\r\n    at Layer.handle [as handle_request] (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/layer.js:95:5)\r\n    at trim_prefix (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/index.js:312:13)\r\n    at /Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/index.js:280:7\r\n---------------------------------------------\r\n    at IncomingMessage.Readable.on (_stream_readable.js:665:33)\r\n    at readStream (/Users/xxxxxx/dev/stormpath-app/node_modules/raw-body/index.js:231:10)\r\n    at getRawBody (/Users/xxxxxx/dev/stormpath-app/node_modules/raw-body/index.js:106:12)\r\n    at read (/Users/xxxxxx/dev/stormpath-app/node_modules/body-parser/lib/read.js:76:3)\r\n    at urlencodedParser (/Users/xxxxxx/dev/stormpath-app/node_modules/body-parser/lib/types/urlencoded.js:109:5)\r\n    at Layer.handle [as handle_request] (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/layer.js:95:5)\r\n    at trim_prefix (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/index.js:312:13)\r\n    at /Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/index.js:280:7\r\n    at Function.process_params (/Users/xxxxxx/dev/stormpath-app/node_modules/express/lib/router/index.js:330:12)\r\n```"},"comment":{"url":"https://api.github.com/repos/stormpath/express-stormpath/issues/comments/153120630","html_url":"https://github.com/stormpath/express-stormpath/issues/180#issuecomment-153120630","issue_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/180","id":153120630,"user":{"login":"baer","id":940667,"avatar_url":"https://avatars.githubusercontent.com/u/940667?v=3","gravatar_id":"","url":"https://api.github.com/users/baer","html_url":"https://github.com/baer","followers_url":"https://api.github.com/users/baer/followers","following_url":"https://api.github.com/users/baer/following{/other_user}","gists_url":"https://api.github.com/users/baer/gists{/gist_id}","starred_url":"https://api.github.com/users/baer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baer/subscriptions","organizations_url":"https://api.github.com/users/baer/orgs","repos_url":"https://api.github.com/users/baer/repos","events_url":"https://api.github.com/users/baer/events{/privacy}","received_events_url":"https://api.github.com/users/baer/received_events","type":"User","site_admin":false},"created_at":"2015-11-02T18:42:53Z","updated_at":"2015-11-02T18:42:53Z","body":"Update: This is most likely an incompatibility between [node-http-proxy](https://github.com/nodejitsu/node-http-proxy) and [express-stormpath](https://github.com/stormpath/express-stormpath). It's not yet clear what the problem is - bug report is now up to date."}}