mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 13:51:09 +08:00
FIX: Correctly render 403 errors to crawlers using basic-html (#26287)
Previously, when crawlers triggered a Discourse::InvalidAccess exception, they would be served the full Ember SPA. The SPA is not optimized for crawling, and so this is likely to cause problems for sites. This issue is particularly problematic when user profiles are hidden from the public via the `hide_user_profiles_from_public` setting, because the crawler would end up being 'soft-redirected' to the homepage in the SPA.
This commit is contained in:
@ -339,7 +339,7 @@ class ApplicationController < ActionController::Base
|
||||
return render plain: message, status: status_code
|
||||
end
|
||||
with_resolved_locale do
|
||||
error_page_opts[:layout] = (opts[:include_ember] && @preloaded) ? "application" : "no_ember"
|
||||
error_page_opts[:layout] = (opts[:include_ember] && @preloaded) ? set_layout : "no_ember"
|
||||
render html: build_not_found_page(error_page_opts)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user