Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/controllers/pageflow/entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def index
)

if entry
handle_public_entry_request(entry)
respond_to do |format|
format.html { handle_public_entry_request(entry) }
end
elsif site.home_url.present?
redirect_to(site.home_url, allow_other_host: true)
else
Expand Down
16 changes: 16 additions & 0 deletions spec/requests/pageflow/entries_index_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ module Pageflow
.to include('Root Story published rendered by entry type frontend app')
end

it 'responds with not found for non-html format' do
site = create(:site, cname: 'pageflow.example.com')
create(:entry,
:published,
site:,
type_name: 'test',
title: 'Root Story',
permalink_attributes: {slug: '', allow_root_path: true})

get('/',
params: {},
headers: {'HTTP_HOST' => 'pageflow.example.com', 'HTTP_ACCEPT' => 'text/plain'})

expect(response.status).to eq(404)
end

it 'responds with not found if no site matches cname' do
get('/', params: {}, headers: {'HTTP_HOST' => 'unknown.example.com'})

Expand Down
Loading