Commit 40903a98 authored by jejacks0n's avatar jejacks0n

Add development-ish domains to redirect validation

- This allows common development urls to be considered valid on
experiment redirect urls. This improves development support.
parent 5eccf5b3
...@@ -42,7 +42,7 @@ Gitlab::Experiment.configure do |config| ...@@ -42,7 +42,7 @@ Gitlab::Experiment.configure do |config|
# This behavior doesn't make perfect sense for self managed installs either, # This behavior doesn't make perfect sense for self managed installs either,
# so we don't think we should redirect in those cases. # so we don't think we should redirect in those cases.
# #
valid_domains = %w[about.gitlab.com docs.gitlab.com gitlab.com] valid_domains = %w[about.gitlab.com docs.gitlab.com gitlab.com gdk.test localhost]
config.redirect_url_validator = lambda do |url| config.redirect_url_validator = lambda do |url|
Gitlab.dev_env_or_com? && (url = URI.parse(url)) && valid_domains.include?(url.host) Gitlab.dev_env_or_com? && (url = URI.parse(url)) && valid_domains.include?(url.host)
rescue URI::InvalidURIError rescue URI::InvalidURIError
......
...@@ -251,6 +251,8 @@ RSpec.describe ApplicationExperiment, :experiment do ...@@ -251,6 +251,8 @@ RSpec.describe ApplicationExperiment, :experiment do
"https://badplace.com\nhttps://gitlab.com" | nil "https://badplace.com\nhttps://gitlab.com" | nil
'https://gitlabbcom' | nil 'https://gitlabbcom' | nil
'https://gitlabbcom/' | nil 'https://gitlabbcom/' | nil
'http://gdk.test/foo/bar' | 'http://gdk.test/foo/bar'
'http://localhost:3000/foo/bar' | 'http://localhost:3000/foo/bar'
end end
with_them do with_them do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment