Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/546669204/sw-sub-directory
利用 Service-worker 实现域名绑定子目录
https://github.com/546669204/sw-sub-directory
Last synced: 12 days ago
JSON representation
利用 Service-worker 实现域名绑定子目录
- Host: GitHub
- URL: https://github.com/546669204/sw-sub-directory
- Owner: 546669204
- License: mit
- Created: 2021-11-03T01:56:20.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-03T02:28:05.000Z (about 3 years ago)
- Last Synced: 2024-11-07T11:23:50.318Z (2 months ago)
- Language: HTML
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sw-sub-directory
利用 ServiceWorker 实现域名绑定子目录在OSS里面 Bucket 域名只能绑定根目录来实现静态资源展示
但是我们要实现多域名绑定子目录要怎么办呢。## Usage
修改 `sw.js` 文件顶部的config对象
```diff
let config = {
- "blog.abc.com":"/www/blog",
- "static.abc.com":"/www/static",
+ "domain1.abc.com":"/www/domain1",
+ "domain2.abc.com":"/domain2",
+ ...
//...
//"域名":"映射路径",
}
```部署到网站根目录