{"action":"created","issue":{"url":"https://api.github.com/repos/ninenines/cowboy/issues/904","labels_url":"https://api.github.com/repos/ninenines/cowboy/issues/904/labels{/name}","comments_url":"https://api.github.com/repos/ninenines/cowboy/issues/904/comments","events_url":"https://api.github.com/repos/ninenines/cowboy/issues/904/events","html_url":"https://github.com/ninenines/cowboy/issues/904","id":112207189,"number":904,"title":"websocket not working with ranch proxy protocol","user":{"login":"comtihon","id":1421547,"avatar_url":"https://avatars.githubusercontent.com/u/1421547?v=3","gravatar_id":"","url":"https://api.github.com/users/comtihon","html_url":"https://github.com/comtihon","followers_url":"https://api.github.com/users/comtihon/followers","following_url":"https://api.github.com/users/comtihon/following{/other_user}","gists_url":"https://api.github.com/users/comtihon/gists{/gist_id}","starred_url":"https://api.github.com/users/comtihon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/comtihon/subscriptions","organizations_url":"https://api.github.com/users/comtihon/orgs","repos_url":"https://api.github.com/users/comtihon/repos","events_url":"https://api.github.com/users/comtihon/events{/privacy}","received_events_url":"https://api.github.com/users/comtihon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-19T18:44:02Z","updated_at":"2015-10-20T16:50:41Z","closed_at":null,"body":"Related issues https://github.com/heroku/ranch_proxy_protocol/issues/16, https://github.com/ninenines/cowboy/issues/708\r\nI try to get client's real ip address and use ranch_proxy_protocol for it. As I figured out from https://github.com/ninenines/cowboy/issues/708 all I need is to change Transport to `{ok, _} = ranch:start_listener(client_handler, Acceptors, ranch_proxy,\r\n[{port, Port}], cowboy_protocol, [{env, [{dispatch, Dispatch}]}])`\r\nBut it is not working for me. I use both master branches for all repos.\r\nI wrote simple websocket handler and try to connect to it using [gun](https://github.com/ninenines/gun) with ranch_proxy_protocol.\r\nAs I can see from scanning traffic - cowboy wan't upgrade protocol, as it get upgrade packet, but don't send websocket packets.\r\nI add some logs and noticed, that on ranch step only difference is in \\#http_req.socket difference, as ranch_proxy stores proxyinfo in it.\r\nOn upgrading to websocket I saw enother difference -> in proper behaviour ranch_acceptor runs accept loop two more times and call cowboy_protocol:start_link. \r\nThats all.\r\n [proper_log](https://www.dropbox.com/s/qxxtyk3d7wvlhpn/proper_log.txt?dl=0)\r\n [wrong_log](https://www.dropbox.com/s/sir2fllv63iva1h/wrong_log.txt?dl=0)\r\nNeed help or example, how to deal with it. Thanks.\r\n"},"comment":{"url":"https://api.github.com/repos/ninenines/cowboy/issues/comments/149630588","html_url":"https://github.com/ninenines/cowboy/issues/904#issuecomment-149630588","issue_url":"https://api.github.com/repos/ninenines/cowboy/issues/904","id":149630588,"user":{"login":"essen","id":141739,"avatar_url":"https://avatars.githubusercontent.com/u/141739?v=3","gravatar_id":"","url":"https://api.github.com/users/essen","html_url":"https://github.com/essen","followers_url":"https://api.github.com/users/essen/followers","following_url":"https://api.github.com/users/essen/following{/other_user}","gists_url":"https://api.github.com/users/essen/gists{/gist_id}","starred_url":"https://api.github.com/users/essen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/essen/subscriptions","organizations_url":"https://api.github.com/users/essen/orgs","repos_url":"https://api.github.com/users/essen/repos","events_url":"https://api.github.com/users/essen/events{/privacy}","received_events_url":"https://api.github.com/users/essen/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T16:50:41Z","updated_at":"2015-10-20T16:50:41Z","body":"In #708 I suggested making a custom protocol (using it instead of cowboy_protocol) and calling cowboy_protocol:parse_request/3 when you need to handle the request. I did not suggest modifying cowboy_protocol.\r\n\r\nThere's not much I can help you with here. It's been done a few times by various people but it's not something I currently support."}}