{"componentChunkName":"component---src-templates-platform-tsx","path":"/platforms/javascript/guides/cordova/sourcemaps/hosting-publicly/","result":{"data":{"file":{"id":"1f38535c-2699-52b3-ae92-2bbbf410237a","relativePath":"javascript/common/sourcemaps/hosting-publicly.mdx","sourceInstanceName":"platforms","childMarkdownRemark":null,"childMdx":{"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Hosting Publicly\"\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar CodeTabs = makeShortcode(\"CodeTabs\");\nvar CodeBlock = makeShortcode(\"CodeBlock\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"By default, Sentry will look for source map directives in your compiled JavaScript files, which are located on the last line and have the following format:\"), mdx(\"div\", {\n    \"className\": \"code-tabs-wrapper\"\n  }, mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"javascript\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"javascript\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token comment\"\n  }), \"//# sourceMappingURL=<url>\"))))))), mdx(\"p\", null, \"When Sentry encounters such a directive, it will resolve the source map URL relative the source file in which it is found, and attempt an HTTP request to fetch it.\"), mdx(\"p\", null, \"For example, if you have a minified JavaScript file located at \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"http://example.org/js/app.min.js\"), \" and in that file, on the last line, the following directive is found:\"), mdx(\"div\", {\n    \"className\": \"code-tabs-wrapper\"\n  }, mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"javascript\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"javascript\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token comment\"\n  }), \"//# sourceMappingURL=app.js.map\"))))))), mdx(\"p\", null, \"Sentry will attempt to fetch \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"app.js.map\"), \" from \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"http://example.org/js/app.js.map\"\n  }), \"http://example.org/js/app.js.map\"), \".\"), mdx(\"p\", null, \"Alternatively, during source map generation you can specify a fully qualified URL where your source maps are located:\"), mdx(\"div\", {\n    \"className\": \"code-tabs-wrapper\"\n  }, mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"javascript\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"javascript\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token comment\"\n  }), \"//# sourceMappingURL=http://example.org/js/app.js.map\"))))))), mdx(\"p\", null, \"While making source maps available to Sentry from your servers is the most natural integration, it is not always advisable:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Sentry may not always be able to reach your servers.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"If you do not specify versions in your asset URLs, there may be a version mismatch\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The additional latency may mean that source mappings are not available for all errors.\")), mdx(\"p\", null, \"For these reasons, it is best practice to upload source maps to Sentry beforehand (see below).\"), mdx(\"h2\", {\n    \"id\": \"working-behind-a-firewall\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#working-behind-a-firewall\",\n    \"aria-label\": \"working behind a firewall permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Working Behind a Firewall\"), mdx(\"p\", null, \"While the recommended solution is to upload your source artifacts to Sentry, sometimes it\\u2019s necessary to allow communication from Sentry\\u2019s internal IPs. For more information on Sentry\\u2019s public IPs see: \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"/product/security/ip-ranges/\"\n  }), \"IP Ranges\"), \".\"), mdx(\"h2\", {\n    \"id\": \"secure-access-to-source-maps\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#secure-access-to-source-maps\",\n    \"aria-label\": \"secure access to source maps permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Secure Access to Source Maps\"), mdx(\"p\", null, \"If you want to keep your source maps secret and choose not to upload your source maps directly to Sentry, you can enable the \\u201CSecurity Token\\u201D option in your project settings.\"), mdx(\"p\", null, \"This will cause outbound requests from Sentry\\u2019s servers to URLs originating from your \\u201CAllowed Domains\\u201D to have the HTTP header \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"X-Sentry-Token\"), \" header append:\"), mdx(\"div\", {\n    \"className\": \"code-tabs-wrapper\"\n  }, mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"bash\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-bash\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-bash\"\n  }), \"GET /assets/bundle.min.js\\nX-Sentry-Token: \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"{\"), \"token\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"}\"))))))), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"token\"), \" is a secure value you define in your project's settings. You can then configure your web server to allow access to your source maps when this header/token pair is present. You can alternatively override the default header name (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"X-Sentry-Token\"), \") and use HTTP Basic Authentication, for example by passing \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Authorization: Basic {encoded_password}.\")));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#working-behind-a-firewall","title":"Working Behind a Firewall"},{"url":"#secure-access-to-source-maps","title":"Secure Access to Source Maps"}]},"internal":{"type":"Mdx"}}}},"pageContext":{"excerpt":"By default, Sentry will look for source map directives in your compiled JavaScript files, which are located on the last line and have the following format: When Sentry encounters such a directive, it will resolve the source map URL relative the source file in which it is found, and attempt an HTTP request to fetch it. For example, if you have a minified JavaScript file located at  http://example.org/js/app.min.js  and in that file, on the last line, the following directive is found: Sentry will attempt to fetch  app.js.map  from  http://example.org/js/app.js.map . Alternatively, during source map generation you can specify a fully qualified URL where your source maps are located: While making source maps available to Sentry from your servers is the most natural integration, it is not always advisable: Sentry may not always be able to reach your servers. If you do not specify versions in your asset URLs, there may be a version mismatch The additional latency may mean that source mappings are not available for all errors. For these reasons, it is best practice to upload source maps to Sentry beforehand (see below). Working Behind a Firewall While the recommended solution is to upload your source artifacts to Sentry, sometimes it’s necessary to allow communication from Sentry’s internal IPs. For more information on Sentry’s public IPs see:  IP Ranges . Secure Access to Source Maps If you want to keep your source maps secret and choose not to upload your source maps directly to Sentry, you can enable the “Security Token” option in your project settings. This will cause outbound requests from Sentry’s servers to URLs originating from your “Allowed Domains” to have the HTTP header  X-Sentry-Token  header append: The  token  is a secure value you define in your project's settings. You can then configure your web server to allow access to your source maps when this header/token pair is present. You can alternatively override the default header name ( X-Sentry-Token ) and use HTTP Basic Authentication, for example by passing  Authorization: Basic {encoded_password}.","title":"Hosting Publicly","platform":{"name":"javascript","title":"JavaScript"},"guide":{"name":"cordova","title":"Cordova"},"noindex":true,"notoc":true,"redirect_from":[],"id":"1f38535c-2699-52b3-ae92-2bbbf410237a"}},"staticQueryHashes":["1218203755","1222113826","1222113826","1766336459","2158593473","2404336828","2472290386","2764967025","3818502851","4015007367","4192517163","4264099332","518019976"]}