diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 0d84c3222..2e2e68a27 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,6 +1,7 @@
+
<%= csp_meta_tag %>
<%=t "head.title", title: (yield :head_title) %>
diff --git a/app/views/layouts/shareable_links.html.erb b/app/views/layouts/shareable_links.html.erb
index e7d5a9725..43802498b 100644
--- a/app/views/layouts/shareable_links.html.erb
+++ b/app/views/layouts/shareable_links.html.erb
@@ -1,6 +1,7 @@
+
<%= csp_meta_tag %>
<%=t "head.title", title: (yield :head_title) %>
diff --git a/app/views/layouts/sign_in_halt.html.erb b/app/views/layouts/sign_in_halt.html.erb
index 3946cc12b..ecdd2b3ba 100644
--- a/app/views/layouts/sign_in_halt.html.erb
+++ b/app/views/layouts/sign_in_halt.html.erb
@@ -3,6 +3,7 @@
+
<%= csp_meta_tag %>
<%=t "head.title", title: (yield :head_title) %>
diff --git a/config/application.rb b/config/application.rb
index fd973052e..33f356134 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -15,6 +15,8 @@ require 'action_view/railtie'
# require "rails/test_unit/railtie"
require 'datadog/auto_instrument' if ENV['DD_TRACE_ENABLED'] == 'true'
+require_relative '../lib/rack_x_robots_tag'
+
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
@@ -58,6 +60,9 @@ module Scinote
# Add rack-attack middleware for request rate limiting
config.middleware.use Rack::Attack
+ # Add X-Robots-Tag header to all responses, to prevent search engine indexing
+ config.middleware.use Rack::XRobotsTag
+
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
config.encoding = 'utf-8'
diff --git a/lib/rack_x_robots_tag.rb b/lib/rack_x_robots_tag.rb
new file mode 100644
index 000000000..26a245dce
--- /dev/null
+++ b/lib/rack_x_robots_tag.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Rack
+ class XRobotsTag
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ status, headers, response = @app.call(env)
+
+ headers['X-Robots-Tag'] = 'none'
+
+ [status, headers, response]
+ end
+ end
+end