{"action":"created","issue":{"url":"https://api.github.com/repos/jfurrow/flood/issues/713","repository_url":"https://api.github.com/repos/jfurrow/flood","labels_url":"https://api.github.com/repos/jfurrow/flood/issues/713/labels{/name}","comments_url":"https://api.github.com/repos/jfurrow/flood/issues/713/comments","events_url":"https://api.github.com/repos/jfurrow/flood/issues/713/events","html_url":"https://github.com/jfurrow/flood/issues/713","id":361509720,"node_id":"MDU6SXNzdWUzNjE1MDk3MjA=","number":713,"title":"Multiple browser refreshes to establish rTorrent connection","user":{"login":"Do-while-Bacon","id":9923207,"node_id":"MDQ6VXNlcjk5MjMyMDc=","avatar_url":"https://avatars0.githubusercontent.com/u/9923207?v=4","gravatar_id":"","url":"https://api.github.com/users/Do-while-Bacon","html_url":"https://github.com/Do-while-Bacon","followers_url":"https://api.github.com/users/Do-while-Bacon/followers","following_url":"https://api.github.com/users/Do-while-Bacon/following{/other_user}","gists_url":"https://api.github.com/users/Do-while-Bacon/gists{/gist_id}","starred_url":"https://api.github.com/users/Do-while-Bacon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Do-while-Bacon/subscriptions","organizations_url":"https://api.github.com/users/Do-while-Bacon/orgs","repos_url":"https://api.github.com/users/Do-while-Bacon/repos","events_url":"https://api.github.com/users/Do-while-Bacon/events{/privacy}","received_events_url":"https://api.github.com/users/Do-while-Bacon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-09-18T22:36:39Z","updated_at":"2018-09-22T14:52:33Z","closed_at":null,"author_association":"NONE","body":"## Summary\r\nSeveral browser refreshes are needed to establish a connection to rTorrent using UNIX socket.\r\n\r\nEDIT: in Firefox\r\n\r\n## Expected Behavior\r\nFlood should load on the first try.\r\n\r\n## Current Behavior\r\nEvery time I visit Flood, I have to CTRL+F5 between 4-8 times to get the torrent status page to load. It hangs at this stage:\r\n\r\n![Image](https://i.imgur.com/Z2ZDSzT.jpg)\r\n\r\nIf I leave it there long enough, it will eventually time out with \"Cannot connect to rTorrent.\" Rapidly refreshing the page will eventually get it to connect. When it does connect, there is no delay at all.\r\n\r\n## Steps to Reproduce \r\n1. Configure rTorrent to use a UNIX socket\r\n2. Configure Flood to point to that socket\r\n3. NGINX reverse proxy\r\n4. Access with Firefox\r\n\r\n## Your Environment\r\nCentOS 7.5.1804\r\nNode.js version 10.10.0\r\nFlood commit 8867c7d3df16fdccbb4d882a0ea042d49f0b64c6\r\nrTorrent version 0.9.6-2 (epel release)\r\nNGINX (reverse proxy) version 1.12.2-2 (epel release)\r\nFirefox 62\r\n\r\nFlood config.js:\r\n```\r\nconst CONFIG = {\r\n  baseURI: '/flood',\r\n  dbCleanInterval: 1000 * 60 * 60,\r\n  dbPath: './server/db/',\r\n  floodServerHost: '0.0.0.0',\r\n  floodServerPort: 3000,\r\n  floodServerProxy: 'http://127.0.0.1:3000',\r\n  maxHistoryStates: 30,\r\n  torrentClientPollInterval: 1000 * 2,\r\n  secret: '{REDACTED}',\r\n  ssl: false,\r\n  sslKey: '/absolute/path/to/key/',\r\n  sslCert: '/absolute/path/to/certificate/'\r\n};\r\n```\r\n\r\nrTorrent config (relevant lines):\r\n```\r\nnetwork.scgi.open_local = /run/rtorrent/.rtorrent.sock\r\nschedule2 = chmod_scgi_socket, 0, 0, \"execute2=chmod,\\\"g+w,o=\\\",/run/rtorrent/.rtorrent.sock\"\r\n```\r\n\r\nNGINX config (relevant lines):\r\n```\r\n        location /flood/ {\r\n            proxy_pass http://127.0.0.1:3000/;\r\n            allow 192.168.1.0/24;\r\n            allow 192.168.2.0/24;\r\n            deny all;\r\n        }\r\n```\r\n\r\nI have confirmed that the \"flood\" daemon user has permission to read and write the rtorrent.sock (of course it would never work if it didn't).\r\n\r\nBoth rtorrent and Flood are configured as systemd services.\r\n\r\nThanks for any advice you can offer.\r\n\r\nEDIT: After further testing, it appears that this issue only happens on Firefox. I have been unable to reproduce it on Chrome."},"comment":{"url":"https://api.github.com/repos/jfurrow/flood/issues/comments/423749470","html_url":"https://github.com/jfurrow/flood/issues/713#issuecomment-423749470","issue_url":"https://api.github.com/repos/jfurrow/flood/issues/713","id":423749470,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzc0OTQ3MA==","user":{"login":"noraj","id":16578570,"node_id":"MDQ6VXNlcjE2NTc4NTcw","avatar_url":"https://avatars3.githubusercontent.com/u/16578570?v=4","gravatar_id":"","url":"https://api.github.com/users/noraj","html_url":"https://github.com/noraj","followers_url":"https://api.github.com/users/noraj/followers","following_url":"https://api.github.com/users/noraj/following{/other_user}","gists_url":"https://api.github.com/users/noraj/gists{/gist_id}","starred_url":"https://api.github.com/users/noraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noraj/subscriptions","organizations_url":"https://api.github.com/users/noraj/orgs","repos_url":"https://api.github.com/users/noraj/repos","events_url":"https://api.github.com/users/noraj/events{/privacy}","received_events_url":"https://api.github.com/users/noraj/received_events","type":"User","site_admin":false},"created_at":"2018-09-22T14:52:33Z","updated_at":"2018-09-22T14:52:33Z","author_association":"COLLABORATOR","body":"@Do-while-Bacon \r\nI commented `floodServerProxy` because it is only for dev and on the past it made bug my app.\r\n\r\n```\r\n// Used for development. See the \"Local Development\" section of README.md\r\n  // for detail.\r\n  /*floodServerProxy: 'https://127.0.0.1',*/\r\n```\r\n\r\nAlso I suggest you to put `floodServerHost: '127.0.0.1',` you don't need to expose all interfaces, only localhost is needed for the reverse proxy. This will be more secure.\r\n\r\nFor rtorrent connection I'm using a TCP socket `scgi_port = 127.0.0.1:5000`, it working. I know a UNIX socket is more secure, so if you make it work with a UNIX socket I'm interested to know the working conf.\r\n\r\nIn your nginx config try to change your `proxy_pass` removing the trailing slash. I also have a rewrite rule `rewrite ^/(.*) /$1 break;` but I don't really if it is needed anymore."}}
{"actor":{"display_login":"noraj"}}