Browse Source

Merge pull request #2923 from overleaf/jpa-sentry-in-staging

[misc] sentry: allow reports for resources on the same origin and CDN

GitOrigin-RevId: 617939dccef839eb80df0b9d84e6684b5b2e618f
Jakob Ackermann 6 years ago
parent
commit
5d9740408a

+ 2 - 0
services/web/app/src/infrastructure/ExpressLocals.js

@@ -366,6 +366,8 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) {
       recaptchaDisabled:
         Settings.recaptcha != null ? Settings.recaptcha.disabled : undefined,
       validRootDocExtensions: Settings.validRootDocExtensions,
+      sentryAllowedOriginRegex:
+        Settings.sentry && Settings.sentry.allowedOriginRegex,
       sentryDsn: Settings.sentry != null ? Settings.sentry.publicDSN : undefined
     }
     next()

+ 2 - 3
services/web/frontend/js/utils/sentry.js

@@ -7,11 +7,10 @@ if (window.ExposedSettings.sentryDsn) {
     Sentry.init({
       dsn: window.ExposedSettings.sentryDsn,
 
-      // Ignore errors unless they come from overleaf.com/sharelatex.com
+      // Ignore errors unless they come from our origins
       // Adapted from: https://docs.sentry.io/platforms/javascript/#decluttering-sentry
       whitelistUrls: [
-        /https:\/\/[a-z]+\.overleaf\.com/,
-        /https:\/\/[a-z]+\.sharelatex\.com/
+        new RegExp(window.ExposedSettings.sentryAllowedOriginRegex)
       ],
 
       ignoreErrors: [