diff --git a/src/sentry/lang/javascript/processor.py b/src/sentry/lang/javascript/processor.py index 2689e388d7208d..94144860d0d1e0 100644 --- a/src/sentry/lang/javascript/processor.py +++ b/src/sentry/lang/javascript/processor.py @@ -331,7 +331,11 @@ def fetch_file(url, project=None, release=None, allow_scraping=True): if project and is_valid_origin(url, project=project): token = project.get_option('sentry:token') if token: - headers['X-Sentry-Token'] = token + token_header = project.get_option( + 'sentry:token_header', + 'X-Sentry-Token', + ) + headers[token_header] = token logger.debug('Fetching %r from the internet', url) diff --git a/src/sentry/web/frontend/project_settings.py b/src/sentry/web/frontend/project_settings.py index 696102753433e0..52cc2defc9a4d8 100644 --- a/src/sentry/web/frontend/project_settings.py +++ b/src/sentry/web/frontend/project_settings.py @@ -28,8 +28,17 @@ class EditProjectForm(forms.ModelForm): team = CustomTypedChoiceField(choices=(), coerce=int, required=False) origins = OriginsField(label=_('Allowed Domains'), required=False, help_text=_('Separate multiple entries with a newline.')) - token = forms.CharField(label=_('Security token'), required=True, - help_text=_('Outbound requests matching Allowed Domains will have the header "X-Sentry-Token: {token}" appended.')) + token = forms.CharField( + label=_('Security token'), + help_text=_('Outbound requests matching Allowed Domains will have the header "{token_header}: {token}" appended.'), + required=True, + ) + token_header = forms.CharField( + label=_('Security token name'), + help_text=_('Outbound requests matching Allowed Domains will have the header "{token_header}: {token}" appended.'), + required=True, + initial='X-Sentry-Token', + ) resolve_age = RangeField(label=_('Auto resolve'), required=False, min_value=0, max_value=168, step_value=1, help_text=_('Automatically resolve an issue if it hasn\'t been seen for this amount of time.')) diff --git a/tests/sentry/web/frontend/test_project_settings.py b/tests/sentry/web/frontend/test_project_settings.py index 0cc0be36989fc8..55e30e7ed67851 100644 --- a/tests/sentry/web/frontend/test_project_settings.py +++ b/tests/sentry/web/frontend/test_project_settings.py @@ -80,7 +80,8 @@ def test_valid_params(self): 'slug': self.project.slug, 'team': self.team.id, 'scrub_data': '1', - 'token': 'foobar', + 'token': 'Basic Zm9vOmJhcg==', + 'token_header': 'Authorization' }) assert resp.status_code == 302 self.assertEquals(resp['Location'], 'http://testserver' + self.path)