SPA 来自同一域中的 S3 和 Java 后端。ALB 修复了响应限制

SPA 来自同一域中的 S3 和 Java 后端。ALB 修复了响应限制

我希望将 S3 存储的单页应用程序及其后端存储在同一个域中。现在,我正在使用 ALB 侦听器配置为我的index.html(按路径)提供固定响应。默认规则指向托管我的 Java 后端的目标组。由于索引文件中有多个 Content-Security-Policy 条目,我非常接近达到 1024 个字符的限制。您知道有什么方法可以避免这种情况吗?我index.html看起来或多或少像这样:

<!doctype html><html lang="en">
<head>
<base href="/">
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' https://xxx.s3.eu-central-1.amazonaws.com https://www.gstatic.com/recaptcha/ https://www.google.com/recaptcha/">
<meta name="viewport" content='width=device-width, initial-scale=1, maximum-scale=1, minimal-ui'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel='icon' href='/favicon.ico'></head>
<body>
  <xxx-root>
  </xxx-root>
  <script src="https://xxx.s3.eu-central-1.amazonaws.com/runtime.js.gz" defer></script>
</body>
</html>

相关内容