-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: Host Redirect #1455
Add: Host Redirect #1455
Conversation
👍 感谢你对 Flutter / Dart 文档本地化做出的贡献! 查看该 PR 的预览 URL (已更新至 commit: 38a44b1): https://flutter-cn-docs-prod--pr1455-host-redirect-pp6fphjn.web.app 查看本 PR 贡献的链接预览:https://flutter-cn-docs-prod--pr1455-host-redirect-pp6fphjn.web.app/docs/content/404.html (页面失效时间 2024/6/7 17:34:28 (北京时间)) 本工具 修改自 部署至 🔥 Firebase Hosting。 Sign: 4be6fc4fb8f048b3225659bec78d08e623eb7688 |
这相当于是在前端用 js 的方式跳转了对吧?@AmosHuKe |
@chenglu 是的,临时这样处理下,看起来还可以。 |
@chenglu 在没有更优雅的方式前(也许和上游对齐?),也许会一直用这个方式了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
https://github.com/cfug/team/issues/54
一个临时的重定向工具。
由于 OSS 部分限制的问题,
无法将大量重定向逻辑在服务端直接使用(类似 Nginx、Apache 等),
所有无法访问的链接会被重定向至 404 页,
该工具利用 404 页,将 firebase.json 内的重定向逻辑运行在 404 页面。
关于 firebase.json 内重定向的相关资料:
host-redirect.min.js 做了什么?
解析 firebase.json 内重定向 source 和 regex 对应的 glob 和 RE2 规则,
并生成新的路由进行重定向。
host-redirect.min.js 会在何时生成?
当发生以下情况时,会自动执行 CI 并生成 host-redirect.min.js 到指定文件夹。
演示链接
{ "regex": "^\/(flutter(\/.*)?)", "destination": "https://api.flutter-io.cn/:1", "type": 301 }
链接:https://flutter-cn-docs-prod--pr1455-host-redirect-pp6fphjn.web.app/flutter/animation/animation-library.html
{ "regex": "^\/(javadoc(\/.*)?)", "destination": "https://api.flutter-io.cn/:1", "type": 301 }
链接:https://flutter-cn-docs-prod--pr1455-host-redirect-pp6fphjn.web.app/javadoc/index.html
{ "source": "/ads", "destination": "https://flutter.cn/monetization", "type": 301 }
链接:https://flutter-cn-docs-prod--pr1455-host-redirect-pp6fphjn.web.app/ads
{ "source": "/adaptive*", "destination": "/ui/adaptive-responsive", "type": 301 }
https://flutter-cn-docs-prod--pr1455-host-redirect-pp6fphjn.web.app/adaptive-12345
{ "source": "/flutter-for-:platform*", "destination": "/get-started/flutter-for/:platform*-devs", "type": 301 }
链接:https://flutter-cn-docs-prod--pr1455-host-redirect-pp6fphjn.web.app/flutter-for-android