惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
WordPress大学
WordPress大学
罗磊的独立博客
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Help Net Security
S
SegmentFault 最新的问题
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
Engineering at Meta
Engineering at Meta
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
D
DataBreaches.Net
雷峰网
雷峰网
GbyAI
GbyAI
宝玉的分享
宝玉的分享

czp's blog

Ubuntu 下使用 zsh · HonKit 使用 VNC 来远程管理服务器 · HonKit Linux 下无限试用 JetBrains · HonKit 使用 KMS 激活 Windows · HonKit 为 KVM 中的 Windows 虚拟机启用 VirtIO · HonKit 在 Spring Boot 中处理 MissingKotlinParameterException · HonKit 用 Spring Native 拯救微服务 · HonKit 正确调试 PHP · HonKit Ubuntu 增加最大文件打开数量限制 · HonKit 将 Minecraft 服务端编译到 native · HonKit 用凝聚力购买 P 社游戏 DLC · HonKit 模拟超星网课 Android 客户端 · HonKit 模拟 Bilibili Android 客户端 · HonKit 模拟哔咔 Android 客户端 · HonKit 异步是什么 · HonKit GCP Pub/Sub push 至 IAP 保护的 Endpoint · HonKit 部署 Spring Native 到 GCP App Engine · HonKit 多个 Gradle SubProject 同时编译导致 CI/CD 内存耗尽 · HonKit Google Cloud Build 运行 DIND · HonKit Terraform 不自动更新 CloudRun service · HonKit Telegram Bot 收不到普通群聊消息的问题 · HonKit 加密货币交易 · HonKit 挖掘以太坊 · HonKit 挖掘门罗币 · HonKit 小明学英语 · HonKit 卖程序的小女孩 · HonKit 一个测试工程师走进一家酒吧 · HonKit 我给你们讲个 TCP 笑话吧! · HonKit 我给你们讲个 UDP 笑话吧! · HonKit 格局打开 · HonKit
在 Google Storage 中部署 SPA · HonKit
2026-04-11 · via czp's blog

本文撰写时的年份: 2023

谢天谢地, 你们谷歌终于在去年底搞出了 Storage 的 404 页面配置.

https://cloud.google.com/storage/docs/hosting-static-website#specialty-pages

单页应用的最大问题是, 虽然全都是静态页面, 但是浏览器刷新时, 实际访问的 path 不对应服务器上的任何文件. 因此若是通常用 Nginx 或者别的 web server 部署 SPA 时都要额外加一条规则, 让 web server 将所有 404 的请求分配到首页(index.html)去.

而谷歌 Storage 现在才支持这种功能:

gcloud storage buckets update gs://my-static-assets --web-main-page-suffix=index.html --web-error-page=index.html

把首页和 404 页面都配置到 index.html. 这下终于 SPA 了起来.

但是事情仍未结束, 你们谷歌 Storage 自定义域名不支持 SSL, 还必须再套一层负载均衡, 妥妥的骗钱: https://cloud.google.com/storage/docs/hosting-static-website#lb-ssl

本来以 Storage 低廉的价格终于可以很便宜的部署一个 SPA 网站, 结果算上负载均衡, 又不便宜了 XD