summaryrefslogtreecommitdiff
path: root/lib/gitlab/experimentation/controller_concern.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/experimentation/controller_concern.rb')
-rw-r--r--lib/gitlab/experimentation/controller_concern.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/gitlab/experimentation/controller_concern.rb b/lib/gitlab/experimentation/controller_concern.rb
index 248abfeada5..e53689eb89b 100644
--- a/lib/gitlab/experimentation/controller_concern.rb
+++ b/lib/gitlab/experimentation/controller_concern.rb
@@ -19,13 +19,18 @@ module Gitlab
end
def set_experimentation_subject_id_cookie
- return if cookies[:experimentation_subject_id].present?
-
- cookies.permanent.signed[:experimentation_subject_id] = {
- value: SecureRandom.uuid,
- secure: ::Gitlab.config.gitlab.https,
- httponly: true
- }
+ if Gitlab.dev_env_or_com?
+ return if cookies[:experimentation_subject_id].present?
+
+ cookies.permanent.signed[:experimentation_subject_id] = {
+ value: SecureRandom.uuid,
+ secure: ::Gitlab.config.gitlab.https,
+ httponly: true
+ }
+ else
+ # We set the cookie before, although experiments are not conducted on self managed instances.
+ cookies.delete(:experimentation_subject_id)
+ end
end
def push_frontend_experiment(experiment_key, subject: nil)