{"action":"opened","issue":{"url":"https://api.github.com/repos/codevise/pageflow/issues/622","repository_url":"https://api.github.com/repos/codevise/pageflow","labels_url":"https://api.github.com/repos/codevise/pageflow/issues/622/labels{/name}","comments_url":"https://api.github.com/repos/codevise/pageflow/issues/622/comments","events_url":"https://api.github.com/repos/codevise/pageflow/issues/622/events","html_url":"https://github.com/codevise/pageflow/issues/622","id":175677722,"number":622,"title":"Add route to allow displaying entry inside iframe","user":{"login":"tf","id":26554,"avatar_url":"https://avatars.githubusercontent.com/u/26554?v=3","gravatar_id":"","url":"https://api.github.com/users/tf","html_url":"https://github.com/tf","followers_url":"https://api.github.com/users/tf/followers","following_url":"https://api.github.com/users/tf/following{/other_user}","gists_url":"https://api.github.com/users/tf/gists{/gist_id}","starred_url":"https://api.github.com/users/tf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tf/subscriptions","organizations_url":"https://api.github.com/users/tf/orgs","repos_url":"https://api.github.com/users/tf/repos","events_url":"https://api.github.com/users/tf/events{/privacy}","received_events_url":"https://api.github.com/users/tf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/codevise/pageflow/labels/beginner","name":"beginner","color":"006b75"},{"url":"https://api.github.com/repos/codevise/pageflow/labels/feature","name":"feature","color":"207db1"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-08T06:47:47Z","updated_at":"2016-09-08T06:47:47Z","closed_at":null,"body":"At the moment entries cannot be embedded on another website via an iframe since Rails sets an `X-Frame-Options: SAMEORIGIN` header by default. It would be nice if for a published entry with route `/my-entry` there was an additional route `/my-entry/embed` that is handled by the same controller action, but does not include the `X-Frame-Options` header.\r\n\r\nTo achieve this, we can add an `after_action` for  [the `show` action of `Pageflow::EntriesController`](https://github.com/codevise/pageflow/blob/master/app/controllers/pageflow/entries_controller.rb#L23) which removes the header when an `embed` param is present.\r\n\r\nThen we can [add a route](https://github.com/codevise/pageflow/blob/master/config/routes.rb#L66) for `/:id/embed` that also goes to `entries#show` and sets the `embed` param [via a default](http://guides.rubyonrails.org/routing.html#defining-defaults).\r\n\r\nWe should also add [a controller spec](https://github.com/codevise/pageflow/blob/master/spec/controllers/pageflow/entries_controller_spec.rb#L151) to test that removing the header by adding the `embed` param works."}}
{"actor":{"display_login":"tf"}}