{"action":"created","issue":{"url":"https://api.github.com/repos/lotus/controller/issues/138","labels_url":"https://api.github.com/repos/lotus/controller/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/lotus/controller/issues/138/comments","events_url":"https://api.github.com/repos/lotus/controller/issues/138/events","html_url":"https://github.com/lotus/controller/issues/138","id":125709478,"number":138,"title":"with session + cookie enabled, set-cookie header for rack.session is sent twice","user":{"login":"pascalbetz","id":16653,"avatar_url":"https://avatars.githubusercontent.com/u/16653?v=3","gravatar_id":"","url":"https://api.github.com/users/pascalbetz","html_url":"https://github.com/pascalbetz","followers_url":"https://api.github.com/users/pascalbetz/followers","following_url":"https://api.github.com/users/pascalbetz/following{/other_user}","gists_url":"https://api.github.com/users/pascalbetz/gists{/gist_id}","starred_url":"https://api.github.com/users/pascalbetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pascalbetz/subscriptions","organizations_url":"https://api.github.com/users/pascalbetz/orgs","repos_url":"https://api.github.com/users/pascalbetz/repos","events_url":"https://api.github.com/users/pascalbetz/events{/privacy}","received_events_url":"https://api.github.com/users/pascalbetz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lotus/controller/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/lotus/controller/labels/discussion","name":"discussion","color":"207de5"}],"state":"open","locked":false,"assignee":{"login":"AlfonsoUceda","id":925961,"avatar_url":"https://avatars.githubusercontent.com/u/925961?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfonsoUceda","html_url":"https://github.com/AlfonsoUceda","followers_url":"https://api.github.com/users/AlfonsoUceda/followers","following_url":"https://api.github.com/users/AlfonsoUceda/following{/other_user}","gists_url":"https://api.github.com/users/AlfonsoUceda/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfonsoUceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfonsoUceda/subscriptions","organizations_url":"https://api.github.com/users/AlfonsoUceda/orgs","repos_url":"https://api.github.com/users/AlfonsoUceda/repos","events_url":"https://api.github.com/users/AlfonsoUceda/events{/privacy}","received_events_url":"https://api.github.com/users/AlfonsoUceda/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/lotus/controller/milestones/13","html_url":"https://github.com/lotus/controller/milestones/v0.5.1","labels_url":"https://api.github.com/repos/lotus/controller/milestones/13/labels","id":1495644,"number":13,"title":"v0.5.1","description":"","creator":{"login":"AlfonsoUceda","id":925961,"avatar_url":"https://avatars.githubusercontent.com/u/925961?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfonsoUceda","html_url":"https://github.com/AlfonsoUceda","followers_url":"https://api.github.com/users/AlfonsoUceda/followers","following_url":"https://api.github.com/users/AlfonsoUceda/following{/other_user}","gists_url":"https://api.github.com/users/AlfonsoUceda/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfonsoUceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfonsoUceda/subscriptions","organizations_url":"https://api.github.com/users/AlfonsoUceda/orgs","repos_url":"https://api.github.com/users/AlfonsoUceda/repos","events_url":"https://api.github.com/users/AlfonsoUceda/events{/privacy}","received_events_url":"https://api.github.com/users/AlfonsoUceda/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2016-01-10T19:29:08Z","updated_at":"2016-01-10T19:29:18Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2016-01-08T22:41:07Z","updated_at":"2016-01-13T21:05:29Z","closed_at":null,"body":"When having ```cookies``` and ```sessions``` enabled, then the __set-cookie__ header for __rack.session__ is sent twice, once with and once without __path__.\r\nThis leads to confusing state when modifying session content.\r\n\r\nSteps to reproduce:\r\n\r\n1) create a new lotus app\r\n2) modify files as follows\r\n```ruby\r\n# application.rb: enable cookies AND sessions\r\n...\r\ncookies true\r\nsessions :cookie, secret: 'verrrrrry-secret'\r\n..\r\n\r\n# routes.rb\r\nget '/', to: 'home#index'\r\n\r\n# web/controllers/home/index.rb\r\nmodule Web::Controllers::Home\r\n\r\n  class Index\r\n    include Web::Action\r\n\r\n    def call(params)\r\n      self.body = 'Welcome'\r\n    end\r\n  end\r\nend\r\n```\r\n3) lotus server\r\n4) visit localhost:2300 and check response headers, you'll see\r\n\r\n```\r\nSet-Cookie:rack.session=BLA...BLA; HttpOnly\r\nSet-Cookie:rack.session=BLA...BLA; path=/; HttpOnly\r\n```\r\n\r\nFirst cookie is from ```cookies``` second one from ```sessions```\r\n\r\nProblem can be \"fixed\" by setting the __path__ of ```cookies``` to the same value as the __path__ of ```sessions``` but still two headers with same content are sent back to the browser.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/lotus/controller/issues/comments/171432279","html_url":"https://github.com/lotus/controller/issues/138#issuecomment-171432279","issue_url":"https://api.github.com/repos/lotus/controller/issues/138","id":171432279,"user":{"login":"AlfonsoUceda","id":925961,"avatar_url":"https://avatars.githubusercontent.com/u/925961?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfonsoUceda","html_url":"https://github.com/AlfonsoUceda","followers_url":"https://api.github.com/users/AlfonsoUceda/followers","following_url":"https://api.github.com/users/AlfonsoUceda/following{/other_user}","gists_url":"https://api.github.com/users/AlfonsoUceda/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfonsoUceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfonsoUceda/subscriptions","organizations_url":"https://api.github.com/users/AlfonsoUceda/orgs","repos_url":"https://api.github.com/users/AlfonsoUceda/repos","events_url":"https://api.github.com/users/AlfonsoUceda/events{/privacy}","received_events_url":"https://api.github.com/users/AlfonsoUceda/received_events","type":"User","site_admin":false},"created_at":"2016-01-13T21:05:29Z","updated_at":"2016-01-13T21:05:29Z","body":"@pascalbetz session is handled by `Rack::Session::Cookie` middleware"}}