{"action":"created","issue":{"url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/618","labels_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/618/labels{/name}","comments_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/618/comments","events_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/618/events","html_url":"https://github.com/cnpm/cnpmjs.org/issues/618","id":73487468,"number":618,"title":"通过apache 配置反向代理， 发布时 404错误","user":{"login":"gogo1217","id":8053078,"avatar_url":"https://avatars.githubusercontent.com/u/8053078?v=3","gravatar_id":"","url":"https://api.github.com/users/gogo1217","html_url":"https://github.com/gogo1217","followers_url":"https://api.github.com/users/gogo1217/followers","following_url":"https://api.github.com/users/gogo1217/following{/other_user}","gists_url":"https://api.github.com/users/gogo1217/gists{/gist_id}","starred_url":"https://api.github.com/users/gogo1217/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gogo1217/subscriptions","organizations_url":"https://api.github.com/users/gogo1217/orgs","repos_url":"https://api.github.com/users/gogo1217/repos","events_url":"https://api.github.com/users/gogo1217/events{/privacy}","received_events_url":"https://api.github.com/users/gogo1217/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-06T01:59:22Z","updated_at":"2015-05-06T02:38:43Z","closed_at":"2015-05-06T02:38:42Z","body":"环境已经搭建好，本地项目可正常 publish 到私服的 7001 端口。\r\n由于公司主机在外网只能访问80端口，所以我们把很多应用交给 apache 反向代理，从而暴露到公网上。\r\n\r\napache 配置信息：\r\n\r\n<VirtualHost *:80>\r\nServerName r.npm.xx.cn\r\nProxyPass  / http://192.168.8.80:7001/\r\nProxyPassReverse / http://192.168.8.80:7001/\r\n</VirtualHost>\r\n\r\n<VirtualHost *:80>\r\nServerName npm.xx.cn\r\nProxyRequests Off\r\nProxyPass  / http://192.168.8.80:7002/\r\nProxyPassReverse / http://192.168.8.80:7002/\r\n</VirtualHost>\r\n\r\n配置重启后， r.npm.xx.cn 和  npm.xx.cn 均能正常访问，也能同步和下载。\r\n但 npm install 时 ，出错，出错内容如下：\r\nnpm ERR! registry error parsing json\r\nnpm ERR! publish Failed PUT 404\r\nnpm ERR! Darwin 14.3.0\r\nnpm ERR! argv \"node\" \"/usr/local/bin/npm\" \"publish\"\r\nnpm ERR! node v0.12.2\r\nnpm ERR! npm  v2.8.4\r\n\r\nnpm ERR! Unexpected token <\r\nnpm ERR! <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\nnpm ERR! <html><head>\r\nnpm ERR! <title>404 Not Found</title>\r\nnpm ERR! </head><body>\r\nnpm ERR! <h1>Not Found</h1>\r\nnpm ERR! <p>The requested URL /@xx/abc was not found on this server.</p>\r\nnpm ERR! </body></html>\r\nnpm ERR! \r\nnpm ERR! \r\nnpm ERR! If you need help, you may report this error at:\r\nnpm ERR!     <https://github.com/npm/npm/issues>\r\n\r\n我理解服务器没有这个内容，应该返回JOSN格式数据，但是却返回了html 内容，导致解析失败。\r\n请各位大佬帮助解决这问题。\r\n"},"comment":{"url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/comments/99299096","html_url":"https://github.com/cnpm/cnpmjs.org/issues/618#issuecomment-99299096","issue_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/618","id":99299096,"user":{"login":"gogo1217","id":8053078,"avatar_url":"https://avatars.githubusercontent.com/u/8053078?v=3","gravatar_id":"","url":"https://api.github.com/users/gogo1217","html_url":"https://github.com/gogo1217","followers_url":"https://api.github.com/users/gogo1217/followers","following_url":"https://api.github.com/users/gogo1217/following{/other_user}","gists_url":"https://api.github.com/users/gogo1217/gists{/gist_id}","starred_url":"https://api.github.com/users/gogo1217/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gogo1217/subscriptions","organizations_url":"https://api.github.com/users/gogo1217/orgs","repos_url":"https://api.github.com/users/gogo1217/repos","events_url":"https://api.github.com/users/gogo1217/events{/privacy}","received_events_url":"https://api.github.com/users/gogo1217/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T02:38:42Z","updated_at":"2015-05-06T02:38:42Z","body":"自己回答吧。\r\n这是因为 提交的时侯 使用了路径 '@xxx%2fabc'  即 '/' 被转义为 '%2f'。apache默认不支持 url 转义，需要在虚拟主机下添加配置以下配置。\r\nAllowEncodedSlashes On"}}