{"action":"created","comment":{"url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/comments/57701874","id":57701874,"diff_hunk":"@@ -4,16 +4,17 @@ BindsTo=neo4j-red@%i.service\n After=neo4j-red@%i.service\n \n [Service]\n-ExecStart=/bin/sh -c \"\\\n-  etcdctl set /vulcand/backends/neo4j-read/backend '{\\\"Type\\\": \\\"http\\\"}'; \\\n-  etcdctl set /vulcand/frontends/neo4j-read/frontend '{\\\"Type\\\": \\\"http\\\", \\\"BackendId\\\": \\\"neo4j-read\\\", \\\"Route\\\": \\\"PathRegexp(`/__neo4j-read/.*`)\\\"}'; \\\n-  etcdctl set /vulcand/frontends/neo4j-read/middlewares/rewrite '{\\\"Id\\\":\\\"rewrite\\\", \\\"Type\\\":\\\"rewrite\\\", \\\"Priority\\\":1, \\\"Middleware\\\": {\\\"Regexp\\\":\\\"/__neo4j-read(/.*)\\\", \\\"Replacement\\\":\\\"$1\\\"}}'; \\\n+ExecStart=/bin/sh -c '\\\n+  etcdctl set /vulcand/backends/neo4j-read/backend \\'{\"Type\": \"http\"}\\'; \\\n+  etcdctl set /vulcand/frontends/neo4j-read/frontend \\'{\"Type\": \"http\", \"BackendId\\\": \"neo4j-read\", \"Route\": \"PathRegexp(`/__neo4j-read/.*`)\", \"Settings\": { \"TrustForwardHeader\": true, \"PassHostHeader\": true }}\\'; \\\n+  etcdctl set /vulcand/frontends/neo4j-read/middlewares/rewrite \\'{\"Id\":\"rewrite\", \"Type\":\"rewrite\", \"Priority\":1, \"Middleware\": {\"Regexp\":\"/__neo4j-read(/.*)\", \"Replacement\":\"$1\"}}\\'; \\\n+  etcdctl set /vulcand/frontends/neo4j-read-db/frontend \\'{\"Type\": \"http\", \"BackendId\": \"neo4j-read\", \"Route\": \"PathRegexp(`^/db/data/.*`) && Header(`User-Agent`, `neoism`)\", \"Settings\": { \"TrustForwardHeader\": true, \"PassHostHeader\": true }}\\'; \\","path":"neo4j-read-red-sidekick@.service","position":12,"original_position":12,"commit_id":"3bdce474a386ba858c2a5616b05002409500ee9c","original_commit_id":"3bdce474a386ba858c2a5616b05002409500ee9c","user":{"login":"carlosroman","id":717815,"avatar_url":"https://avatars.githubusercontent.com/u/717815?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosroman","html_url":"https://github.com/carlosroman","followers_url":"https://api.github.com/users/carlosroman/followers","following_url":"https://api.github.com/users/carlosroman/following{/other_user}","gists_url":"https://api.github.com/users/carlosroman/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosroman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosroman/subscriptions","organizations_url":"https://api.github.com/users/carlosroman/orgs","repos_url":"https://api.github.com/users/carlosroman/repos","events_url":"https://api.github.com/users/carlosroman/events{/privacy}","received_events_url":"https://api.github.com/users/carlosroman/received_events","type":"User","site_admin":false},"body":"```&& Header(`User-Agent`, `neoism`)``` This feels a little bit fragile. It will work for the time being but does mean anything that doesn't use neoism needs to use that header. Something to remember when debuging connection issues.","created_at":"2016-03-29T10:28:10Z","updated_at":"2016-03-29T10:28:10Z","html_url":"https://github.com/Financial-Times/up-service-files/pull/455#discussion_r57701874","pull_request_url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455","_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/comments/57701874"},"html":{"href":"https://github.com/Financial-Times/up-service-files/pull/455#discussion_r57701874"},"pull_request":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455"}}},"pull_request":{"url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455","id":64320521,"html_url":"https://github.com/Financial-Times/up-service-files/pull/455","diff_url":"https://github.com/Financial-Times/up-service-files/pull/455.diff","patch_url":"https://github.com/Financial-Times/up-service-files/pull/455.patch","issue_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues/455","number":455,"state":"open","locked":false,"title":"Making sure neo4j driver always connects to neo4j via vulcan.","user":{"login":"catalin-ilea","id":2073125,"avatar_url":"https://avatars.githubusercontent.com/u/2073125?v=3","gravatar_id":"","url":"https://api.github.com/users/catalin-ilea","html_url":"https://github.com/catalin-ilea","followers_url":"https://api.github.com/users/catalin-ilea/followers","following_url":"https://api.github.com/users/catalin-ilea/following{/other_user}","gists_url":"https://api.github.com/users/catalin-ilea/gists{/gist_id}","starred_url":"https://api.github.com/users/catalin-ilea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catalin-ilea/subscriptions","organizations_url":"https://api.github.com/users/catalin-ilea/orgs","repos_url":"https://api.github.com/users/catalin-ilea/repos","events_url":"https://api.github.com/users/catalin-ilea/events{/privacy}","received_events_url":"https://api.github.com/users/catalin-ilea/received_events","type":"User","site_admin":false},"body":"This not ideal but it works. \r\nNeo4j/neo4j driver try to do all sorts of clever things and compute their own urls when they try to connect to neo using the Host header of the first response. This means that the 2nd request to neo4j will not go via vulcan. As a side-effect the app becomes unhealthy when the neo4j instance which the app initially connected to goes down. \r\n{ \"TrustForwardHeader\": true, \"PassHostHeader\": true } solves this problem and routes all the requests via vulcan.\r\n\r\nThe second problem, now that all requests go via vulcan is that the driver also overwrites the path it uses to connect: /__neo4j-read/db/data becomes /db/data. As a workaround neo4j-read-db was added.\r\n\r\nAs a conclusion neo4j and its driver don't play nice when you overwrite the Host header or rewriter the url path. We should consider updating the public read apis to set a header(not Host) to be used for routing. ","created_at":"2016-03-28T13:17:37Z","updated_at":"2016-03-29T10:28:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73de4c010dc698b0e89491f518f3b40ca7042aeb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455/commits","review_comments_url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455/comments","review_comment_url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues/455/comments","statuses_url":"https://api.github.com/repos/Financial-Times/up-service-files/statuses/3bdce474a386ba858c2a5616b05002409500ee9c","head":{"label":"Financial-Times:neo4j-lb-fix","ref":"neo4j-lb-fix","sha":"3bdce474a386ba858c2a5616b05002409500ee9c","user":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"repo":{"id":36799074,"name":"up-service-files","full_name":"Financial-Times/up-service-files","owner":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Financial-Times/up-service-files","description":"Contains the fleets service files","fork":false,"url":"https://api.github.com/repos/Financial-Times/up-service-files","forks_url":"https://api.github.com/repos/Financial-Times/up-service-files/forks","keys_url":"https://api.github.com/repos/Financial-Times/up-service-files/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Financial-Times/up-service-files/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Financial-Times/up-service-files/teams","hooks_url":"https://api.github.com/repos/Financial-Times/up-service-files/hooks","issue_events_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues/events{/number}","events_url":"https://api.github.com/repos/Financial-Times/up-service-files/events","assignees_url":"https://api.github.com/repos/Financial-Times/up-service-files/assignees{/user}","branches_url":"https://api.github.com/repos/Financial-Times/up-service-files/branches{/branch}","tags_url":"https://api.github.com/repos/Financial-Times/up-service-files/tags","blobs_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/refs{/sha}","trees_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Financial-Times/up-service-files/statuses/{sha}","languages_url":"https://api.github.com/repos/Financial-Times/up-service-files/languages","stargazers_url":"https://api.github.com/repos/Financial-Times/up-service-files/stargazers","contributors_url":"https://api.github.com/repos/Financial-Times/up-service-files/contributors","subscribers_url":"https://api.github.com/repos/Financial-Times/up-service-files/subscribers","subscription_url":"https://api.github.com/repos/Financial-Times/up-service-files/subscription","commits_url":"https://api.github.com/repos/Financial-Times/up-service-files/commits{/sha}","git_commits_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/commits{/sha}","comments_url":"https://api.github.com/repos/Financial-Times/up-service-files/comments{/number}","issue_comment_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues/comments{/number}","contents_url":"https://api.github.com/repos/Financial-Times/up-service-files/contents/{+path}","compare_url":"https://api.github.com/repos/Financial-Times/up-service-files/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Financial-Times/up-service-files/merges","archive_url":"https://api.github.com/repos/Financial-Times/up-service-files/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Financial-Times/up-service-files/downloads","issues_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues{/number}","pulls_url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls{/number}","milestones_url":"https://api.github.com/repos/Financial-Times/up-service-files/milestones{/number}","notifications_url":"https://api.github.com/repos/Financial-Times/up-service-files/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Financial-Times/up-service-files/labels{/name}","releases_url":"https://api.github.com/repos/Financial-Times/up-service-files/releases{/id}","deployments_url":"https://api.github.com/repos/Financial-Times/up-service-files/deployments","created_at":"2015-06-03T11:23:15Z","updated_at":"2016-03-21T08:42:03Z","pushed_at":"2016-03-29T10:23:56Z","git_url":"git://github.com/Financial-Times/up-service-files.git","ssh_url":"git@github.com:Financial-Times/up-service-files.git","clone_url":"https://github.com/Financial-Times/up-service-files.git","svn_url":"https://github.com/Financial-Times/up-service-files","homepage":null,"size":1191,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":7,"forks":1,"open_issues":7,"watchers":4,"default_branch":"master"}},"base":{"label":"Financial-Times:master","ref":"master","sha":"423542f4952877a5069f22923766fd805b3968c3","user":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"repo":{"id":36799074,"name":"up-service-files","full_name":"Financial-Times/up-service-files","owner":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Financial-Times/up-service-files","description":"Contains the fleets service files","fork":false,"url":"https://api.github.com/repos/Financial-Times/up-service-files","forks_url":"https://api.github.com/repos/Financial-Times/up-service-files/forks","keys_url":"https://api.github.com/repos/Financial-Times/up-service-files/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Financial-Times/up-service-files/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Financial-Times/up-service-files/teams","hooks_url":"https://api.github.com/repos/Financial-Times/up-service-files/hooks","issue_events_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues/events{/number}","events_url":"https://api.github.com/repos/Financial-Times/up-service-files/events","assignees_url":"https://api.github.com/repos/Financial-Times/up-service-files/assignees{/user}","branches_url":"https://api.github.com/repos/Financial-Times/up-service-files/branches{/branch}","tags_url":"https://api.github.com/repos/Financial-Times/up-service-files/tags","blobs_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/refs{/sha}","trees_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Financial-Times/up-service-files/statuses/{sha}","languages_url":"https://api.github.com/repos/Financial-Times/up-service-files/languages","stargazers_url":"https://api.github.com/repos/Financial-Times/up-service-files/stargazers","contributors_url":"https://api.github.com/repos/Financial-Times/up-service-files/contributors","subscribers_url":"https://api.github.com/repos/Financial-Times/up-service-files/subscribers","subscription_url":"https://api.github.com/repos/Financial-Times/up-service-files/subscription","commits_url":"https://api.github.com/repos/Financial-Times/up-service-files/commits{/sha}","git_commits_url":"https://api.github.com/repos/Financial-Times/up-service-files/git/commits{/sha}","comments_url":"https://api.github.com/repos/Financial-Times/up-service-files/comments{/number}","issue_comment_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues/comments{/number}","contents_url":"https://api.github.com/repos/Financial-Times/up-service-files/contents/{+path}","compare_url":"https://api.github.com/repos/Financial-Times/up-service-files/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Financial-Times/up-service-files/merges","archive_url":"https://api.github.com/repos/Financial-Times/up-service-files/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Financial-Times/up-service-files/downloads","issues_url":"https://api.github.com/repos/Financial-Times/up-service-files/issues{/number}","pulls_url":"https://api.github.com/repos/Financial-Times/up-service-files/pulls{/number}","milestones_url":"https://api.github.com/repos/Financial-Times/up-service-files/milestones{/number}","notifications_url":"https://api.github.com/repos/Financial-Times/up-service-files/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Financial-Times/up-service-files/labels{/name}","releases_url":"https://api.github.com/repos/Financial-Times/up-service-files/releases{/id}","deployments_url":"https://api.github.com/repos/Financial-Times/up-service-files/deployments","created_at":"2015-06-03T11:23:15Z","updated_at":"2016-03-21T08:42:03Z","pushed_at":"2016-03-29T10:23:56Z","git_url":"git://github.com/Financial-Times/up-service-files.git","ssh_url":"git@github.com:Financial-Times/up-service-files.git","clone_url":"https://github.com/Financial-Times/up-service-files.git","svn_url":"https://github.com/Financial-Times/up-service-files","homepage":null,"size":1191,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":7,"forks":1,"open_issues":7,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455"},"html":{"href":"https://github.com/Financial-Times/up-service-files/pull/455"},"issue":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/issues/455"},"comments":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/issues/455/comments"},"review_comments":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455/comments"},"review_comment":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/pulls/455/commits"},"statuses":{"href":"https://api.github.com/repos/Financial-Times/up-service-files/statuses/3bdce474a386ba858c2a5616b05002409500ee9c"}}}}