mirror of
https://github.com/discourse/discourse.git
synced 2025-04-16 19:31:29 +08:00
FIX: Set X-Robots-Tag header to prevent indexing of /safe-mode (#32329)
This change adds the `X-Robots-Tag` header to the `/safe-mode` response, discouraging search engines from including the page in their index.
This commit is contained in:
parent
8ccb66a44a
commit
9b351614ea
@ -8,6 +8,7 @@ class SafeModeController < ApplicationController
|
||||
skip_before_action :preload_json, :check_xhr
|
||||
|
||||
def index
|
||||
response.headers["X-Robots-Tag"] = "noindex, nofollow"
|
||||
end
|
||||
|
||||
def enter
|
||||
|
@ -21,6 +21,11 @@ RSpec.describe SafeModeController do
|
||||
expect(response.body).not_to include("My Custom Header")
|
||||
expect(response.body).not_to include("data-theme-id=\"#{theme.id}\"")
|
||||
end
|
||||
|
||||
it "sets the robots header" do
|
||||
get "/safe-mode"
|
||||
expect(response.headers["X-Robots-Tag"]).to eq("noindex, nofollow")
|
||||
end
|
||||
end
|
||||
|
||||
describe "enter" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user