{"action":"created","issue":{"url":"https://api.github.com/repos/ib-controller/ib-controller/issues/22","labels_url":"https://api.github.com/repos/ib-controller/ib-controller/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/ib-controller/ib-controller/issues/22/comments","events_url":"https://api.github.com/repos/ib-controller/ib-controller/issues/22/events","html_url":"https://github.com/ib-controller/ib-controller/issues/22","id":65288383,"number":22,"title":"Using ssh forwarding - The remote host closed the connection","user":{"login":"ibizaman","id":1044950,"avatar_url":"https://avatars.githubusercontent.com/u/1044950?v=3","gravatar_id":"","url":"https://api.github.com/users/ibizaman","html_url":"https://github.com/ibizaman","followers_url":"https://api.github.com/users/ibizaman/followers","following_url":"https://api.github.com/users/ibizaman/following{/other_user}","gists_url":"https://api.github.com/users/ibizaman/gists{/gist_id}","starred_url":"https://api.github.com/users/ibizaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibizaman/subscriptions","organizations_url":"https://api.github.com/users/ibizaman/orgs","repos_url":"https://api.github.com/users/ibizaman/repos","events_url":"https://api.github.com/users/ibizaman/events{/privacy}","received_events_url":"https://api.github.com/users/ibizaman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-30T19:53:51Z","updated_at":"2015-03-31T09:06:47Z","closed_at":null,"body":"Hi,\r\n\r\nI know this is strictly speaking not relative to ibcontroller but since you mention this tip in the README itself, maybe you already tried this method and already stumbled and overcomed the problem I have.\r\n\r\nSo I would like to connect to the ibgateway running on a remote server thanks to ssh forwarding. On the client where I want to connect the API, I run this command:\r\n``` bash\r\n$ ssh -L 4001:localhost:4001 me@192.168.1.2 -N\r\n```\r\nThe ssh connection is established but when trying to connect the API, I get an error (retrieved by the EWrapper method \"error\"):\r\n```\r\nid: -1, errorCode: 502, errorString: The remote host closed the connection\r\n```\r\n\r\nTo debug this, I tried:\r\n* connecting to the ibgateway from the server itself and it works.\r\n* forwarding something else like the webserver running on the server machine and it works:\r\n``` bash\r\n$ ssh -L 4001:localhost:80 me@192.168.1.2 -N\r\n$ curl localhost:4001\r\n```\r\nThis outputs the correct html page.\r\nSo for me, the ssh tunnel works as expected and the ibgateway also. But there must be something I'm missing. Do you have any idea what could it be?\r\n\r\nHere is my .ini, in case it could help:\r\n```\r\nLogToConsole=yes\r\nFIX=no\r\nPasswordEncrypted=no\r\nFIXLoginId=\r\nFIXPassword=\r\nFIXPasswordEncrypted=yes\r\nStoreSettingsOnServer=no\r\nMinimizeMainWindow=yes\r\nExistingSessionDetectedAction=primary\r\nAcceptIncomingConnectionAction=accept\r\nShowAllTrades=no\r\nIbAutoClosedown=no\r\nClosedownAt=\r\nAllowBlindTrading=yes\r\nDismissPasswordExpiryWarning=yes\r\nDismissNSEComplianceNotice=yes\r\nIbControlFrom=\r\nIbBindAddress=127.0.0.1\r\nCommandPrompt=\r\nSuppressInfoMessages=no\r\n```"},"comment":{"url":"https://api.github.com/repos/ib-controller/ib-controller/issues/comments/88005874","html_url":"https://github.com/ib-controller/ib-controller/issues/22#issuecomment-88005874","issue_url":"https://api.github.com/repos/ib-controller/ib-controller/issues/22","id":88005874,"user":{"login":"rlktradewright","id":7384655,"avatar_url":"https://avatars.githubusercontent.com/u/7384655?v=3","gravatar_id":"","url":"https://api.github.com/users/rlktradewright","html_url":"https://github.com/rlktradewright","followers_url":"https://api.github.com/users/rlktradewright/followers","following_url":"https://api.github.com/users/rlktradewright/following{/other_user}","gists_url":"https://api.github.com/users/rlktradewright/gists{/gist_id}","starred_url":"https://api.github.com/users/rlktradewright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlktradewright/subscriptions","organizations_url":"https://api.github.com/users/rlktradewright/orgs","repos_url":"https://api.github.com/users/rlktradewright/repos","events_url":"https://api.github.com/users/rlktradewright/events{/privacy}","received_events_url":"https://api.github.com/users/rlktradewright/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T09:06:46Z","updated_at":"2015-03-31T09:06:46Z","body":"So as I understand it, you are trying to connect to the API on the gateway over an ssh tunnel. You are not trying to connect to IBController's command server.\r\n\r\nIf that's correct, then yes indeed this really isn't anything to do with IBController, so this really isn't the right place to ask the question. Just to be absolutely clear, IBController has nothing whatever to do with API connections - it knows nothing about them and does not intervene in any way when an API client connects to TWS/Gateway.\r\n\r\nHowever, my off the cuff response is that you possibly just haven't configured the IP address of your source machine as a trusted IP address in the API settings."}}