From c86009d849bd28acd865a907496372d47e086813 Mon Sep 17 00:00:00 2001 From: yugasun Date: Fri, 26 Mar 2021 15:17:00 +0800 Subject: [PATCH 01/20] fix: support ignoreHtmlExt, close #36 --- docs/configure.md | 2 ++ src/package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/configure.md b/docs/configure.md index 30368a5..6612c79 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -22,6 +22,7 @@ inputs: bucketName: my-bucket protocol: http replace: false # 是否覆盖式部署 + ignoreHtmlExt: false # 是否是否忽略 html 扩展名,默认 false disableErrorStatus: false # 是否禁用错误码,默认 false autoSetupAcl: true # 自动配置 bucket 访问权限为 ”公有读私有写“ autoSetupPolicy: false # 自动配置 bucket 的 Policy 权限为 ”所有用户资源可读“ @@ -105,6 +106,7 @@ inputs: | autoSetupAcl | 否 | boolean | `true` | 自动配置 bucket 访问权限为 ”公有读私有写“ | | autoSetupPolicy | 否 | boolean | `false` | 自动配置 bucket 的 Policy 权限为 ”所有用户资源可读“ | | disableErrorStatus | 否 | boolean | `false` | 是否禁用错误码,默认 false,不存在文件会返回 404;如果禁用,就会返回 200 | +| ignoreHtmlExt | 否 | boolean | `false` | 是否忽略 html 扩展名,默认 false | > 针对 COS 静态资源托管,通常需要配置所有用户公有读私有写,website 组件因此默认通过配置 `autoSetupAcl` 为 `true`,来帮助用户自动配置访问权限为 `公有读私有写`,由于 COS 针对账号的 ACL 配置条数有 1000 限制,当子账号很多的情况下,通过 `autoSetupAcl` 来配置 ACL 可能超过上限。此时用户可以配置 `autoSetupAcl` 为 `false`,同时配置 `autoSetupPolicy` 为 `true`,来解决此问题。 diff --git a/src/package.json b/src/package.json index e8c0bf0..c6c469c 100644 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^2.5.3", + "tencent-component-toolkit": "^2.5.5", "type": "^2.1.0" } } From 0c0ffd385056dc97fbc136e7253bdbdc39b2b4b4 Mon Sep 17 00:00:00 2001 From: slsplus Date: Fri, 26 Mar 2021 07:21:55 +0000 Subject: [PATCH 02/20] chore(release): version 0.1.4 ## [0.1.4](https://github.com/serverless-components/tencent-website/compare/v0.1.3...v0.1.4) (2021-03-26) ### Bug Fixes * support ignoreHtmlExt, close [#36](https://github.com/serverless-components/tencent-website/issues/36) ([c86009d](https://github.com/serverless-components/tencent-website/commit/c86009d849bd28acd865a907496372d47e086813)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7860520..c81ff65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.1.4](https://github.com/serverless-components/tencent-website/compare/v0.1.3...v0.1.4) (2021-03-26) + + +### Bug Fixes + +* support ignoreHtmlExt, close [#36](https://github.com/serverless-components/tencent-website/issues/36) ([c86009d](https://github.com/serverless-components/tencent-website/commit/c86009d849bd28acd865a907496372d47e086813)) + ## [0.1.3](https://github.com/serverless-components/tencent-website/compare/v0.1.2...v0.1.3) (2021-03-24) From 66a4369e3d71bea62a1411350aa723479a69aa80 Mon Sep 17 00:00:00 2001 From: yugasun Date: Fri, 26 Mar 2021 15:23:45 +0800 Subject: [PATCH 03/20] chore: update version in serverless.component.yml --- serverless.component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverless.component.yml b/serverless.component.yml index 8b15ff7..dd28ccc 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: website -version: 0.1.3 +version: 0.1.4 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: Deploy a static website on Tencent Cloud. From 981988773e1bbb77dbb2c9ac466a9a490fe13021 Mon Sep 17 00:00:00 2001 From: yugasun Date: Mon, 29 Mar 2021 14:50:47 +0800 Subject: [PATCH 04/20] docs: add faq --- README.md | 4 ++++ docs/faq.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 docs/faq.md diff --git a/README.md b/README.md index 05398ad..5677989 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,10 @@ TENCENT_SECRET_ID=123 TENCENT_SECRET_KEY=123 ``` +## FAQ + +[参考](./docs/faq.md) + ## License MIT License diff --git a/docs/faq.md b/docs/faq.md new file mode 100644 index 0000000..23178a3 --- /dev/null +++ b/docs/faq.md @@ -0,0 +1,33 @@ +# FAQ + +## COS 桶 ACL 策略超限 + +通常报错如下: + +``` +6s > websiteDemo > Your policy or acl has reached the limit +//... +``` + +针对 COS 静态资源托管,通常需要配置所有用户公有读私有写,website 组件因此默认通过配置 `autoSetupAcl` 为 `true`,来帮助用户自动配置访问权限为 `公有读私有写`, +由于 COS 针对账号的 `ACL` 配置条数有 `1000` 限制,当子账号很多的情况下,通过 `autoSetupAcl` 来配置 ACL 可能超过上限。 +此时用户可以配置 `autoSetupAcl` 为 `false`,同时配置 `autoSetupPolicy` 为 `true`,来解决此问题。如下: + +```yaml +app: appDemo +stage: dev +component: website +name: websiteDemo + +inputs: + src: + src: ./src + index: index.html + error: index.html + region: ap-guangzhou + bucketName: my-bucket + protocol: https + # 添加以下配置 + autoSetupAcl: false + autoSetupPolicy: true +``` From 968b74b00896b2c998f5f5670a47062da88d38e6 Mon Sep 17 00:00:00 2001 From: yugasun Date: Mon, 29 Mar 2021 17:38:34 +0800 Subject: [PATCH 05/20] feat: suppport cache bucket name in state --- __tests__/index.test.js | 2 +- example/serverless.yml | 6 +++--- serverless.component.yml | 2 +- src/package.json | 3 +-- src/serverless.js | 5 +++++ src/utils.js | 7 ++++--- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/__tests__/index.test.js b/__tests__/index.test.js index 41771f0..acfdc73 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -22,7 +22,7 @@ const instanceYaml = { index: 'index.html', error: 'index.html' }, - bucketName: 'my-bucket', + bucketName: 'website-integration-test', region: 'ap-guangzhou', } } diff --git a/example/serverless.yml b/example/serverless.yml index 1dee9db..8e7cd76 100644 --- a/example/serverless.yml +++ b/example/serverless.yml @@ -1,7 +1,7 @@ -org: orgDemo app: appDemo stage: dev -component: website + +component: website@dev name: websiteDemo inputs: @@ -10,5 +10,5 @@ inputs: index: index.html error: index.html region: ap-guangzhou - bucketName: my-bucket + bucketName: website-demo protocol: https diff --git a/serverless.component.yml b/serverless.component.yml index dd28ccc..c6d3407 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: website -version: 0.1.4 +version: 0.2.0 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: Deploy a static website on Tencent Cloud. diff --git a/src/package.json b/src/package.json index c6c469c..bcc6633 100644 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,6 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^2.5.5", - "type": "^2.1.0" + "tencent-component-toolkit": "^2.5.5" } } diff --git a/src/serverless.js b/src/serverless.js index c166de4..214e0c8 100644 --- a/src/serverless.js +++ b/src/serverless.js @@ -22,6 +22,10 @@ class ServerlessComponent extends Component { } } + getAppId() { + return this.credentials.tencent.tmpSecrets.appId + } + getDefaultProtocol(protocols) { if (String(protocols).includes('https')) { return 'https' @@ -87,6 +91,7 @@ class ServerlessComponent extends Component { } this.state = { region, + bucket: websiteInputs.bucket, website: websiteInputs } diff --git a/src/utils.js b/src/utils.js index 9318a33..f9eaa89 100644 --- a/src/utils.js +++ b/src/utils.js @@ -41,6 +41,7 @@ const removeAppid = (str, appid) => { } const prepareInputs = async (instance, inputs) => { + const { state } = instance let code = inputs.src || '' code = typeof code === 'string' @@ -51,8 +52,8 @@ const prepareInputs = async (instance, inputs) => { ...code } - const zipPath = await getCodeZipPath(this, code) - const { appId } = instance.credentials.tencent.tmpSecrets + const zipPath = await getCodeZipPath(instance, code) + const appId = instance.getAppId() const envPath = (inputs.srcOriginal && inputs.srcOriginal.envPath) || './' let sourceDirectory = await instance.unzip(zipPath) if (!code.src) { @@ -62,7 +63,7 @@ const prepareInputs = async (instance, inputs) => { const region = inputs.region || CONFIGS.region const bucketName = - removeAppid(inputs.bucketName, appId) || `sls-website-${region}-${generateId()}` + removeAppid(inputs.bucketName || state.bucket, appId) || `sls-website-${region}-${generateId()}` const websiteInputs = Object.assign(inputs, { replace: inputs.replace, From 22d59d3b8c9172b283c9001d67bf9ec85c12b9dc Mon Sep 17 00:00:00 2001 From: yugasun Date: Tue, 30 Mar 2021 16:24:25 +0800 Subject: [PATCH 06/20] fix: update deps --- README.md | 4 +-- docs/README.md | 7 +++++ docs/advance.md | 63 ++++++++++++++++++++++++++++++++++++++++++ docs/configure.md | 4 +-- example/serverless.yml | 2 +- src/package.json | 2 +- 6 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 docs/README.md create mode 100644 docs/advance.md diff --git a/README.md b/README.md index 5677989..f636364 100644 --- a/README.md +++ b/README.md @@ -146,9 +146,9 @@ TENCENT_SECRET_ID=123 TENCENT_SECRET_KEY=123 ``` -## FAQ +## 使用文档 -[参考](./docs/faq.md) +[使用文档](./docs/README.md) ## License diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..b78a4e1 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,7 @@ +# 文档 + +## 目录 + +- [全量配置](./configure.md) +- [高级配置](./advance.md) +- [常见问题](./faq.md) diff --git a/docs/advance.md b/docs/advance.md new file mode 100644 index 0000000..2844be6 --- /dev/null +++ b/docs/advance.md @@ -0,0 +1,63 @@ +## 高级配置 + +### env + +serverless 部署时会将 `env` 下配置的参数写入 `env.js` 文件中,将该文件打包上传到相对于 `src` 的 `envPath` 目录,默认为 `src` 指定目录。 + +比如配置了: + +```yaml +app: appDemo +stage: dev + +component: website +name: websiteDemo + +inputs: + src: + src: ./src + index: index.html + error: index.html + region: ap-guangzhou + bucketName: website-demo + protocol: https + # env 配置 + env: + API_URL: https://api.com +``` + +那么静态项目根目录下生成的 `env.js` 文件内容如下: + +```js +window.env = {} +window.env.API_URL = 'https://api.com' +``` + +然后,我们可以在前端项目中给所有的请求 URL 添加 `window.env.API_URL` 前缀,通常在全栈应用中,会使用到。比如在部署完后端服务后会生产后端服务网关 `url`,然后我们将上面的的 `API_URL` 赋值为后端服务的 `url`,就可以做到无需手动引入修改接口链接了。具体使用请参考 [全栈应用案例](https://github.com/serverless-components/tencent-examples/tree/master/fullstack) + +### hook & dist + +serverless cli 支持配置 `hook` 配置来帮用户执行部署前的命令,比如前端项目需要通过 `npm run build` 命令构建,然后才会部署,那么可以配置如下: + +```yaml +app: appDemo +stage: dev + +component: website +name: websiteDemo + +inputs: + src: + dist: ./dist + hook: npm run build + index: index.html + error: index.html + region: ap-guangzhou + bucketName: website-demo + protocol: https +``` + +- **hook**: 指定部署前需要执行的命令 +- **dist**: 指定执行 `hook` 命令后,需要部署到云端的代码目录 + +> 注意:`hook` 必须和 `dist` 一起用。 diff --git a/docs/configure.md b/docs/configure.md index 6612c79..6a43af3 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -184,7 +184,7 @@ global:全球加速 ### Env -环境变量参数文件。会将 env 下配置的参数写入 env.js 文件中,将该文件打包上传到你的代码里。 +环境变量参数。serverless 部署时会将 `env` 下配置的参数写入 `env.js` 文件中,将该文件打包上传到相对于 `src` 的 `envPath` 目录,默认为 `src` 指定目录。 比如配置了: @@ -200,4 +200,4 @@ window.env = {} window.env.API_URL = 'https://api.com' ``` -让后我们可以在前端项目中给所有的请求 URL 添加 `window.env.API_URL` 前缀,通常在全栈应用中,会使用到。比如在部署完后端服务后会生产后端服务网关 `url`,然后我们将上面的的 `API_URL` 赋值为后端服务的 `url`,就可以做到无需手动引入修改接口链接了。具体使用请参考 [全栈应用案例](https://github.com/serverless-components/tencent-examples/tree/master/fullstack) +然后,我们可以在前端项目中给所有的请求 URL 添加 `window.env.API_URL` 前缀,通常在全栈应用中,会使用到。比如在部署完后端服务后会生产后端服务网关 `url`,然后我们将上面的的 `API_URL` 赋值为后端服务的 `url`,就可以做到无需手动引入修改接口链接了。具体使用请参考 [全栈应用案例](https://github.com/serverless-components/tencent-examples/tree/master/fullstack) diff --git a/example/serverless.yml b/example/serverless.yml index 8e7cd76..8352ff7 100644 --- a/example/serverless.yml +++ b/example/serverless.yml @@ -1,7 +1,7 @@ app: appDemo stage: dev -component: website@dev +component: website name: websiteDemo inputs: diff --git a/src/package.json b/src/package.json index bcc6633..f94f242 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^2.5.5" + "tencent-component-toolkit": "^2.5.6" } } From fa0674a145674da42e6d93b565b489cb16dced2b Mon Sep 17 00:00:00 2001 From: yugasun Date: Wed, 31 Mar 2021 15:03:31 +0800 Subject: [PATCH 07/20] fix: change bucketName to bucket --- README.md | 2 +- __tests__/index.test.js | 2 +- docs/advance.md | 4 ++-- docs/configure.md | 4 ++-- docs/faq.md | 2 +- example/serverless.yml | 4 ++-- src/package.json | 2 +- src/utils.js | 3 ++- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f636364..3f6fb63 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ inputs: # hook: npm run build # websitePath: ./ region: ap-guangzhou - bucketName: my-bucket + bucket: my-bucket protocol: https ``` diff --git a/__tests__/index.test.js b/__tests__/index.test.js index acfdc73..fe7d133 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -22,7 +22,7 @@ const instanceYaml = { index: 'index.html', error: 'index.html' }, - bucketName: 'website-integration-test', + bucket: 'website-integration-test', region: 'ap-guangzhou', } } diff --git a/docs/advance.md b/docs/advance.md index 2844be6..ef3670f 100644 --- a/docs/advance.md +++ b/docs/advance.md @@ -19,7 +19,7 @@ inputs: index: index.html error: index.html region: ap-guangzhou - bucketName: website-demo + bucket: website-demo protocol: https # env 配置 env: @@ -53,7 +53,7 @@ inputs: index: index.html error: index.html region: ap-guangzhou - bucketName: website-demo + bucket: website-demo protocol: https ``` diff --git a/docs/configure.md b/docs/configure.md index 6a43af3..9c2d83d 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -19,7 +19,7 @@ inputs: index: index.html error: index.html region: ap-guangzhou - bucketName: my-bucket + bucket: my-bucket protocol: http replace: false # 是否覆盖式部署 ignoreHtmlExt: false # 是否是否忽略 html 扩展名,默认 false @@ -96,7 +96,7 @@ inputs: | 参数名称 | 必选 | 类型 | 默认值 | 描述 | | ------------------ | :--: | :-------------- | :------------: | :---------------------------------------------------------------------------------------- | | src | 是 | [Src](#Src)[] | | 该项目的代码信息,参数参考执行目录 | -| bucketName | 是 | string | | Bucket 名称。 不允许大写字母。如果你不加 AppId 后缀,则默认自动会为你加上。 | +| bucket | 是 | string | | Bucket 名称。 不允许大写字母。如果你不加 AppId 后缀,则默认自动会为你加上。 | | region | 否 | string | `ap-guangzhou` | 代码上传所在的 cos 区域。区。 | | replace | 否 | boolean | `false` | 是否是替换式部署,如果为 `true`,部署时将 `先删除对应 bucket 的所有旧文件`。 | | protocol | 否 | string | `https` | 请求协议。`https` 或 `http` | diff --git a/docs/faq.md b/docs/faq.md index 23178a3..9526e0e 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -25,7 +25,7 @@ inputs: index: index.html error: index.html region: ap-guangzhou - bucketName: my-bucket + bucket: my-bucket protocol: https # 添加以下配置 autoSetupAcl: false diff --git a/example/serverless.yml b/example/serverless.yml index 8352ff7..8d86016 100644 --- a/example/serverless.yml +++ b/example/serverless.yml @@ -1,7 +1,7 @@ app: appDemo stage: dev -component: website +component: website@dev name: websiteDemo inputs: @@ -10,5 +10,5 @@ inputs: index: index.html error: index.html region: ap-guangzhou - bucketName: website-demo + bucket: website-demo-1303241281 protocol: https diff --git a/src/package.json b/src/package.json index f94f242..d0f2ce4 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^2.5.6" + "tencent-component-toolkit": "^2.5.7" } } diff --git a/src/utils.js b/src/utils.js index f9eaa89..63dd77c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -63,7 +63,8 @@ const prepareInputs = async (instance, inputs) => { const region = inputs.region || CONFIGS.region const bucketName = - removeAppid(inputs.bucketName || state.bucket, appId) || `sls-website-${region}-${generateId()}` + removeAppid(inputs.bucketName || inputs.bucket || state.bucket, appId) || + `sls-website-${region}-${generateId()}` const websiteInputs = Object.assign(inputs, { replace: inputs.replace, From 7513120066868a26202ffe28e5c111fec2ac630a Mon Sep 17 00:00:00 2001 From: slsplus Date: Wed, 31 Mar 2021 07:07:13 +0000 Subject: [PATCH 08/20] chore(release): version 0.2.0 # [0.2.0](https://github.com/serverless-components/tencent-website/compare/v0.1.4...v0.2.0) (2021-03-31) ### Bug Fixes * change bucketName to bucket ([fa0674a](https://github.com/serverless-components/tencent-website/commit/fa0674a145674da42e6d93b565b489cb16dced2b)) * update deps ([22d59d3](https://github.com/serverless-components/tencent-website/commit/22d59d3b8c9172b283c9001d67bf9ec85c12b9dc)) ### Features * suppport cache bucket name in state ([968b74b](https://github.com/serverless-components/tencent-website/commit/968b74b00896b2c998f5f5670a47062da88d38e6)) --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c81ff65..7781c8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +# [0.2.0](https://github.com/serverless-components/tencent-website/compare/v0.1.4...v0.2.0) (2021-03-31) + + +### Bug Fixes + +* change bucketName to bucket ([fa0674a](https://github.com/serverless-components/tencent-website/commit/fa0674a145674da42e6d93b565b489cb16dced2b)) +* update deps ([22d59d3](https://github.com/serverless-components/tencent-website/commit/22d59d3b8c9172b283c9001d67bf9ec85c12b9dc)) + + +### Features + +* suppport cache bucket name in state ([968b74b](https://github.com/serverless-components/tencent-website/commit/968b74b00896b2c998f5f5670a47062da88d38e6)) + ## [0.1.4](https://github.com/serverless-components/tencent-website/compare/v0.1.3...v0.1.4) (2021-03-26) From d136dc5d8cb18fb6b41d9e3b841a748810ae346b Mon Sep 17 00:00:00 2001 From: yugasun Date: Wed, 31 Mar 2021 15:10:41 +0800 Subject: [PATCH 09/20] chore: update example config --- example/serverless.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/serverless.yml b/example/serverless.yml index 8d86016..7fccd6d 100644 --- a/example/serverless.yml +++ b/example/serverless.yml @@ -1,7 +1,7 @@ app: appDemo stage: dev -component: website@dev +component: website name: websiteDemo inputs: @@ -10,5 +10,5 @@ inputs: index: index.html error: index.html region: ap-guangzhou - bucket: website-demo-1303241281 + bucket: website-demo protocol: https From a391ff6a37c0f29e9945ccb81a4f4bfe68c4d965 Mon Sep 17 00:00:00 2001 From: yugasun Date: Sun, 25 Apr 2021 20:14:52 +0800 Subject: [PATCH 10/20] fix: support tag config --- serverless.component.yml | 2 +- src/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/serverless.component.yml b/serverless.component.yml index c6d3407..38111aa 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: website -version: 0.2.0 +version: 0.2.1 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: Deploy a static website on Tencent Cloud. diff --git a/src/package.json b/src/package.json index d0f2ce4..c465f1f 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^2.5.7" + "tencent-component-toolkit": "^2.7.0" } } From 638231c9226002d0f9997851d9b87c2a8f239e3e Mon Sep 17 00:00:00 2001 From: slsplus Date: Mon, 26 Apr 2021 02:12:39 +0000 Subject: [PATCH 11/20] chore(release): version 0.2.1 ## [0.2.1](https://github.com/serverless-components/tencent-website/compare/v0.2.0...v0.2.1) (2021-04-26) ### Bug Fixes * support tag config ([a391ff6](https://github.com/serverless-components/tencent-website/commit/a391ff6a37c0f29e9945ccb81a4f4bfe68c4d965)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7781c8b..f436edd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.2.1](https://github.com/serverless-components/tencent-website/compare/v0.2.0...v0.2.1) (2021-04-26) + + +### Bug Fixes + +* support tag config ([a391ff6](https://github.com/serverless-components/tencent-website/commit/a391ff6a37c0f29e9945ccb81a4f4bfe68c4d965)) + # [0.2.0](https://github.com/serverless-components/tencent-website/compare/v0.1.4...v0.2.0) (2021-03-31) From f266c800ef675e138e5fb0882fb0d3bc60ba571f Mon Sep 17 00:00:00 2001 From: yugasun Date: Thu, 29 Jul 2021 16:22:02 +0800 Subject: [PATCH 12/20] fix: update deps --- serverless.component.yml | 2 +- src/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/serverless.component.yml b/serverless.component.yml index 38111aa..c90f517 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: website -version: 0.2.1 +version: 0.2.3 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: Deploy a static website on Tencent Cloud. diff --git a/src/package.json b/src/package.json index c465f1f..4ef9d4c 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^2.7.0" + "tencent-component-toolkit": "^2.13.4" } } From 3417912dfba5ea4eacab5e2e67ac5dec853f20a0 Mon Sep 17 00:00:00 2001 From: slsplus Date: Thu, 29 Jul 2021 08:23:27 +0000 Subject: [PATCH 13/20] chore(release): version 0.2.2 ## [0.2.2](https://github.com/serverless-components/tencent-website/compare/v0.2.1...v0.2.2) (2021-07-29) ### Bug Fixes * update deps ([f266c80](https://github.com/serverless-components/tencent-website/commit/f266c800ef675e138e5fb0882fb0d3bc60ba571f)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f436edd..e96c22e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.2.2](https://github.com/serverless-components/tencent-website/compare/v0.2.1...v0.2.2) (2021-07-29) + + +### Bug Fixes + +* update deps ([f266c80](https://github.com/serverless-components/tencent-website/commit/f266c800ef675e138e5fb0882fb0d3bc60ba571f)) + ## [0.2.1](https://github.com/serverless-components/tencent-website/compare/v0.2.0...v0.2.1) (2021-04-26) From 8893dbed8f3558a4512a562fc8a9e0082ab5ea44 Mon Sep 17 00:00:00 2001 From: "Oliver.W" Date: Fri, 22 Oct 2021 16:11:36 +0800 Subject: [PATCH 14/20] Update serverless.component.yml (#41) --- serverless.component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverless.component.yml b/serverless.component.yml index c90f517..04f5453 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -2,7 +2,7 @@ name: website version: 0.2.3 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' -description: Deploy a static website on Tencent Cloud. +description: 静态网站组件,允许用户构建部署静态站点到腾讯 COS。适合用来构建部署静态网站。 keywords: 'tencent, serverless, website' repo: 'https://github.com/serverless-components/tencent-website' readme: 'https://github.com/serverless-components/tencent-website/tree/master/README.md' From 38e5744e1fd6ecde9028e527f1f0d9ecebf07c20 Mon Sep 17 00:00:00 2001 From: mamietian Date: Fri, 22 Oct 2021 18:41:12 +0800 Subject: [PATCH 15/20] chore(release): version 0.2.4 --- serverless.component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverless.component.yml b/serverless.component.yml index 04f5453..02c9ad8 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: website -version: 0.2.3 +version: 0.2.4 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: 静态网站组件,允许用户构建部署静态站点到腾讯 COS。适合用来构建部署静态网站。 From 1085e43636b843f329f4ca7367f0b11c93b93136 Mon Sep 17 00:00:00 2001 From: ciryu <35194652+ciryu@users.noreply.github.com> Date: Mon, 29 Nov 2021 11:02:12 +0800 Subject: [PATCH 16/20] docx:update configure description (#43) --- docs/configure.md | 264 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 238 insertions(+), 26 deletions(-) diff --git a/docs/configure.md b/docs/configure.md index 9c2d83d..a000474 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -93,20 +93,20 @@ inputs: 主要参数描述 -| 参数名称 | 必选 | 类型 | 默认值 | 描述 | -| ------------------ | :--: | :-------------- | :------------: | :---------------------------------------------------------------------------------------- | -| src | 是 | [Src](#Src)[] | | 该项目的代码信息,参数参考执行目录 | -| bucket | 是 | string | | Bucket 名称。 不允许大写字母。如果你不加 AppId 后缀,则默认自动会为你加上。 | -| region | 否 | string | `ap-guangzhou` | 代码上传所在的 cos 区域。区。 | -| replace | 否 | boolean | `false` | 是否是替换式部署,如果为 `true`,部署时将 `先删除对应 bucket 的所有旧文件`。 | -| protocol | 否 | string | `https` | 请求协议。`https` 或 `http` | +| 参数名称 | 必选 | 类型 | 默认值 | 描述 | +| ------------------ | :--: | :-------------- | :------------: | :----------------------------------------------------------- | +| src | 是 | [Src](#Src) | | 该项目的代码信息,参数参考执行目录 | +| bucket | 是 | string | | Bucket 名称。 不允许大写字母。如果你不加 AppId 后缀,则默认自动会为你加上。 | +| region | 否 | string | `ap-guangzhou` | 代码上传所在的 cos 区域。区。 | +| replace | 否 | boolean | `false` | 是否是替换式部署,如果为 `true`,部署时将 `先删除对应 bucket 的所有旧文件`。 | +| protocol | 否 | string | `https` | 请求协议。`https` 或 `http` | | env | 否 | [Env](#Env) | | 环境变量参数文件。会将 env 下配置的参数写入 env.js 文件中,将该文件打包上传到你的代码里。 | -| cors | 否 | [Cors](#Cors)[] | | 跨域访问配置 | -| hosts | 否 | [Cdn](#Cdn)[] | | CND 加速域名配置 | -| autoSetupAcl | 否 | boolean | `true` | 自动配置 bucket 访问权限为 ”公有读私有写“ | -| autoSetupPolicy | 否 | boolean | `false` | 自动配置 bucket 的 Policy 权限为 ”所有用户资源可读“ | -| disableErrorStatus | 否 | boolean | `false` | 是否禁用错误码,默认 false,不存在文件会返回 404;如果禁用,就会返回 200 | -| ignoreHtmlExt | 否 | boolean | `false` | 是否忽略 html 扩展名,默认 false | +| cors | 否 | [Cors](#Cors)[] | | 跨域访问配置 | +| hosts | 否 | [Cdn](#Cdn)[] | | CND 加速域名配置 | +| autoSetupAcl | 否 | boolean | `true` | 自动配置 bucket 访问权限为 ”公有读私有写“ | +| autoSetupPolicy | 否 | boolean | `false` | 自动配置 bucket 的 Policy 权限为 ”所有用户资源可读“ | +| disableErrorStatus | 否 | boolean | `false` | 是否禁用错误码,默认 false,不存在文件会返回 404;如果禁用,就会返回 200 | +| ignoreHtmlExt | 否 | boolean | `false` | 是否忽略 html 扩展名,默认 false | > 针对 COS 静态资源托管,通常需要配置所有用户公有读私有写,website 组件因此默认通过配置 `autoSetupAcl` 为 `true`,来帮助用户自动配置访问权限为 `公有读私有写`,由于 COS 针对账号的 ACL 配置条数有 1000 限制,当子账号很多的情况下,通过 `autoSetupAcl` 来配置 ACL 可能超过上限。此时用户可以配置 `autoSetupAcl` 为 `false`,同时配置 `autoSetupPolicy` 为 `true`,来解决此问题。 @@ -129,13 +129,13 @@ inputs: 参考: https://cloud.tencent.com/document/product/436/8279 -| 参数 | 必选 | 类型 | Description | -| -------------- | :--: | :------- | :--------------------------------------------------------------------------------------------- | -| id | 否 | string | 规则 ID | -| allowedMethods | 是 | string[] | 允许的 HTTP 操作,枚举值:GET,PUT,HEAD,POST,DELETE | -| allowedOrigins | 是 | string[] | 允许的访问来源,支持通配符`*`,格式为:`协议://域名[:端口]`,例如:`http://www.qq.com` | -| allowedHeaders | 是 | | 在发送 OPTIONS 请求时告知服务端,接下来的请求可以使用哪些自定义的 HTTP 请求头部,支持通配符`*` | -| maxAgeSeconds | 是 | | 设置 OPTIONS 请求得到结果的有效期 | +| 参数 | 必选 | 类型 | Description | +| -------------- | :--: | :------- | :----------------------------------------------------------- | +| id | 否 | string | 规则 ID | +| allowedMethods | 是 | string[] | 允许的 HTTP 操作,枚举值:GET,PUT,HEAD,POST,DELETE | +| allowedOrigins | 是 | string[] | 允许的访问来源,支持通配符`*`,格式为:`协议://域名[:端口]`,例如:`http://www.qq.com` | +| allowedHeaders | 是 | string[] | 在发送 OPTIONS 请求时告知服务端,接下来的请求可以使用哪些自定义的 HTTP 请求头部,支持通配符`*` | +| maxAgeSeconds | 是 | number | 设置 OPTIONS 请求得到结果的有效期 | ### Cdn @@ -150,11 +150,11 @@ CDN 配置 | refreshCdn | 否 | [RefreshCdn](#RefreshCdn) | | 刷新 CDN 相关配置 | | pushCdn | 否 | [PushCdn](#PushCdn) | | 预热 CDN 相关配置(#pushCdn) | | host | 是 | string | | 需要接入的 CDN 域名。 | -| https | 否 | [Https](https://cloud.tencent.com/document/api/228/30987#Https) | | Https 加速配置 | -| cacheKey | 否 | [CacheKey](https://cloud.tencent.com/document/api/228/30987#CacheKey) | | 节点缓存键配置 | -| cache | 否 | [Cache](https://cloud.tencent.com/document/api/228/30987#Cache) | | 缓存过期时间配置 | -| referer | 否 | [Referer](https://cloud.tencent.com/document/api/228/30987#Referer) | '' | 防盗链设置 | -| ipFilter | 否 | [IpFilter](https://cloud.tencent.com/document/api/228/30987#IpFilter) | '' | IP 黑白名单配置 | +| https | 否 | [Https](#Https) | | Https 加速配置 | +| cacheKey | 否 | [CacheKey](#CacheKey) | | 节点缓存键配置 | +| cache | 否 | [Cache](#Cache) | | 缓存过期时间配置 | +| referer | 否 | [Referer](#Referer) | '' | 防盗链设置 | +| ipFilter | 否 | [IpFilter](#IpFilter) | '' | IP 黑白名单配置 | 使用中国境外加速、全球加速时,需要先开通中国境外加速服务。 @@ -168,7 +168,7 @@ global:全球加速 > 注意:`async` 参数对于配置多个 CDN 域名需求,或者在 CI 流程中时,建议配置成 `true`,不然会导致 serverless cli 执行超时,或者 CI 流程超时。 -更多配置,请移至官方云 API 文档:https://cloud.tencent.com/document/product/228/41123 +更多配置详情,请移至官方云 API 文档:https://cloud.tencent.com/document/product/228/41123 #### RefreshCdn @@ -182,6 +182,218 @@ global:全球加速 | -------- | :--: | :------- | ---- | ------------------- | | urls | 否 | string[] | [] | 需要预热的 CDN URLs | +#### Https + +域名 https 加速配置 + +| 参数名称 | 必选 | 类型 | 默认 | 描述 | +| -------------- | :--: | ------------------------- | ---- | ------------------------------------------------------------ | +| Switch | 是 | string | | https 配置开关。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | +| Http2 | 否 | string | | http2 配置开关。on: 开启;off:关闭;初次启用 https 加速会默认开启 http2 配置 | +| OcspStapling | 否 | string | off | OCSP 配置开关。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | +| VerifyClient | 否 | string | off | 客户端证书校验功能。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | +| CertInfo | 否 | [ServerCert](#ServerCert) | | 服务端证书配置信息 | +| ClientCertInfo | 否 | [ClientCert](#ClientCert) | | 客户端证书配置信息 | +| Spdy | 否 | string | off | Spdy 配置开关。on: 开启;off:关闭 | +| SslStatus | 否 | string | | https 证书部署状态。closed:已关闭;deploying:部署中;deployed:部署成功;failed:部署失败 | +| Hsts | 否 | [Hsts](#Hsts) | | Hsts配置 | +| TlsVersion | 否 | string[] | | Tls版本设置,仅支持部分Advance域名,支持设置 TLSv1, TLSV1.1, TLSV1.2, TLSv1.3,修改时必须开启连续的版本 | + +#### ServerCert + +https 加速服务端证书配置 + +| 参数名称 | 必选 | 类型 | 默认 | 描述 | +| :---------- | ---- | :-------- | ---- | :------------------------------------------------------ | +| CertId | 否 | string | | 服务器证书 ID 在 SSL 证书管理进行证书托管时自动生成 | +| CertName | 否 | string | | 服务器证书名称 在 SSL 证书管理进行证书托管时自动生成 | +| Certificate | 否 | string | | 服务器证书信息 上传自有证书时必填,需要包含完整的证书链 | +| PrivateKey | 否 | string | | 服务器密钥信息 上传自有证书时必填 | +| ExpireTime | 否 | timestamp | | 证书过期时间 作为入参配置时无需填充 | +| DeployTime | 否 | timestamp | | 证书颁发时间 作为入参配置时无需填充 | +| Message | 否 | string | | 证书备注信息 | + +#### ClientCert + +https 客户端证书配置 + +| 参数名称 | 必选 | 类型 | 默认 | 描述 | +| :---------- | ---- | :-------- | ---- | :----------------------------------------- | +| Certificate | 是 | string | | 客户端证书 PEM 格式,需要进行 Base 64 编码 | +| CertName | 否 | string | | 客户端证书名称 | +| ExpireTime | 否 | timestamp | | 证书过期时间 作为入参时无需填充 | +| DeployTime | 否 | timestamp | | 证书颁发时间 作为入参时无需填充 | + +#### Hsts + +HSTS 配置 + +| 参数名称 | 必选 | 类型 | 默认 | 描述 | +| :---------------- | ---- | :----- | ---- | :---------------------- | +| Switch | 是 | string | | 是否开启,on或off。 | +| MaxAge | 否 | number | | MaxAge数值 | +| IncludeSubDomains | 否 | string | | 是否包含子域名,on或off | + +#### CacheKey + +缓存键配置 + +| 参数名称 | 必选 | 类型 | 默认 | 描述 | +| :----------- | ---- | :-------------------------------- | ---- | :----------------------------------------------------------- | +| FullUrlCache | 否 | string | | 是否开启全路径缓存 on:开启全路径缓存(即关闭参数忽略) off:关闭全路径缓存(即开启参数忽略) | +| IgnoreCase | 否 | string | | 是否忽略大小写缓存 | +| Querystring | 否 | [QuerystringKey](#QuerystringKey) | | CacheKey中包含请求参数 | +| Cookie | 否 | [CookieKey](#CookieKey) | | CacheKey中包含Cookie | +| Header | 否 | [HeaderKey](#HeaderKey) | | CacheKey中包含请求头部 | +| CacheTag | 否 | [CacheTagKey](#CacheTagKey) | | CacheKey中包含自定义字符串 | +| Scheme | 否 | [SchemeKey](#SchemeKey) | | CacheKey中包含请求协议 | +| KeyRules | 否 | [KeyRule](#KeyRule)[] | | 分路径缓存键配置 | + +#### QuerystringKey + +组成CacheKey的一部分 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :------ | ---- | :----- | :--- | :----------------------------------------------------------- | +| Switch | 是 | string | | on \| off CacheKey是否由Querystring组成 | +| Reorder | 否 | string | | 是否重新排序 | +| Action | 否 | string | | includeAll \| excludeAll \| includeCustom \| excludeAll 使用/排除部分url参数 | +| Value | 否 | string | | 使用/排除的url参数数组,';' 分割 | + +#### CookieKey + +组成CacheKey的一部分 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----- | ---- | :----- | :--- | :---------------------------------------- | +| Switch | 是 | string | | on \| off 是否使用Cookie作为Cache的一部分 | +| Value | 否 | string | | 使用的cookie,';' 分割 | + +#### HeaderKey + +组成CacheKey + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----- | ---- | :----- | :--- | :--------------------------------- | +| Switch | 否 | string | | 是否组成Cachekey | +| Value | 否 | string | | 组成CacheKey的header数组,';' 分割 | + +#### CacheTagKey + +组成CacheKey的一部分 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----- | ---- | :----- | :--- | :----------------------------------- | +| Switch | 是 | string | | 是否使用CacheTag作为CacheKey的一部分 | +| Value | 否 | string | | 自定义CacheTag的值 | + +#### SchemeKey + +作为CacheKey的一部分 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----- | ---- | :----- | :--- | :-------------------------------------------- | +| Switch | 是 | string | | on \| off 是否使用scheme作为cache key的一部分 | + +#### KeyRule + +缓存键分路径配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----------- | ---- | :---------------------------------- | :--- | :----------------------------------------------------------- | +| RulePaths | 是 | Array of string | | CacheType 对应类型下的匹配内容: file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | +| RuleType | 是 | string | | 规则类型: file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | +| FullUrlCache | 是 | string | | 是否开启全路径缓存 on:开启全路径缓存(即关闭参数忽略) off:关闭全路径缓存(即开启参数忽略) | +| IgnoreCase | 是 | string | | 是否忽略大小写缓存 | +| Querystring | 是 | [RuleQuerystring](#RuleQuerystring) | | CacheKey中包含请求参数 | +| RuleTag | 是 | string | | 路径缓存键标签,传 user | + +#### RuleQuerystring + +路径保留参数配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----- | ---- | :----- | :--- | :-------------------------------------- | +| Switch | 是 | string | | on \| off CacheKey是否由Querystring组成 | +| Action | 是 | string | | includeCustom 包含部分url参数 | +| Value | 是 | string | | 使用/排除的url参数数组,';' 分割 | + +#### Cache + +节点缓存过期时间配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :---------- | ---- | :----------------------------------------------------------- | :--- | :------------------- | +| SimpleCache | 否 | [SimpleCache](https://cloud.tencent.com/document/api/228/30987#SimpleCache) | | 基础缓存过期时间配置 | +| RuleCache | 否 | [RuleCache](#RuleCache)[] | | 高级路径缓存配置 | + +#### SimpleCache + +缓存配置基础版本 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----------------- | ---- | :------------------------------------ | :--- | :----------------------------------------------------------- | +| CacheRules | 是 | [SimpleCacheRule](#SimpleCacheRule)[] | | 缓存过期时间规则 | +| FollowOrigin | 是 | string | | 遵循源站 Cache-Control: max-age 配置 on:开启 off:关闭 | +| IgnoreCacheControl | 是 | string | off | 强制缓存 on:开启 off:关闭,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | +| IgnoreSetCookie | 是 | string | off | 忽略源站的Set-Cookie头部 on:开启 off:关闭 | +| CompareMaxAge | 是 | string | off | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | +| Revalidate | 否 | [Revalidate](#Revalidate) | | 总是回源站校验 | + +#### RuleCache + +缓存配置分路径版本 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :---------- | ---- | :---------------------------------- | :--- | :----------------------------------------------------------- | +| RulePaths | 是 | string[] | | CacheType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | +| RuleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | +| CacheConfig | 是 | [RuleCacheConfig](#RuleCacheConfig) | | 缓存配置 | + +#### Referer + +Referer 黑白名单配置,默认为关闭状态 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----------- | ---- | :---------------------------- | :--- | :------------------------------------------ | +| Switch | 是 | string | | referer 黑白名单配置开关 on:开启 off:关闭 | +| RefererRules | 否 | [RefererRule](#RefererRule)[] | | referer 黑白名单配置规则 | + +#### RefererRule + +Referer 黑白名单配置规则,针对特定资源生效 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :---------- | ---- | :------- | :--- | :----------------------------------------------------------- | +| RuleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 | +| RulePaths | 是 | string[] | | RuleType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test/ path 时填充绝对路径,如 /xxx/test.html | +| RefererType | 是 | string | | referer 配置类型 whitelist:白名单 blacklist:黑名单 | +| Referers | 是 | string[] | | referer 内容列表列表 | +| AllowEmpty | 是 | Boolean | | 是否允许空 referer true:允许空 referer false:不允许空 referer | + +#### IpFilter + +IP 黑白名单配置,默认为关闭状态 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :---------- | ---- | :-------------------------------------- | :--- | :----------------------------------------------------------- | +| Switch | 是 | string | | IP 黑白名单配置开关 on:开启 off:关闭 | +| FilterType | 否 | string | | IP 黑白名单类型 whitelist:白名单 blacklist:黑名单 | +| Filters | 否 | string[] | | IP 黑白名单列表 支持 X.X.X.X 形式 IP,或 /8、 /16、/24 形式网段 最多可填充 50 个白名单或 50 个黑名单 | +| FilterRules | 否 | [IpFilterPathRule](#IpFilterPathRule)[] | | IP 黑白名单分路径配置,白名单功能 | +| ReturnCode | 否 | number | | IP 黑白名单验证失败时返回的 HTTP Code 合法值: 400~499 | + +#### IpFilterPathRule + +IP黑白名单分路径配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :--------- | ---- | :------- | :--- | :----------------------------------------------------------- | +| FilterType | 是 | string | | IP 黑白名单类型 whitelist:白名单 blacklist:黑名单 | +| Filters | 是 | string[] | | IP 黑白名单列表 支持 X.X.X.X 形式 IP,或 /8、 /16、/24 形式网段 最多可填充 50 个白名单或 50 个黑名单 | +| RuleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 | +| RulePaths | 是 | string[] | | RuleType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test/ path 时填充绝对路径,如 /xxx/test.html | + ### Env 环境变量参数。serverless 部署时会将 `env` 下配置的参数写入 `env.js` 文件中,将该文件打包上传到相对于 `src` 的 `envPath` 目录,默认为 `src` 指定目录。 From 33a0f7267aa99087049df590f3a4cdf0a6813f00 Mon Sep 17 00:00:00 2001 From: ciryu <35194652+ciryu@users.noreply.github.com> Date: Mon, 29 Nov 2021 15:40:25 +0800 Subject: [PATCH 17/20] docx:update configure description (#44) --- docs/configure.md | 68 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/docs/configure.md b/docs/configure.md index a000474..d32d308 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -301,7 +301,7 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----------- | ---- | :---------------------------------- | :--- | :----------------------------------------------------------- | -| RulePaths | 是 | Array of string | | CacheType 对应类型下的匹配内容: file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | +| RulePaths | 是 | string[] | | CacheType 对应类型下的匹配内容: file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | | RuleType | 是 | string | | 规则类型: file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | | FullUrlCache | 是 | string | | 是否开启全路径缓存 on:开启全路径缓存(即关闭参数忽略) off:关闭全路径缓存(即开启参数忽略) | | IgnoreCase | 是 | string | | 是否忽略大小写缓存 | @@ -324,7 +324,7 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :---------- | ---- | :----------------------------------------------------------- | :--- | :------------------- | -| SimpleCache | 否 | [SimpleCache](https://cloud.tencent.com/document/api/228/30987#SimpleCache) | | 基础缓存过期时间配置 | +| SimpleCache | 否 | [SimpleCache](#SimpleCache) | | 基础缓存过期时间配置 | | RuleCache | 否 | [RuleCache](#RuleCache)[] | | 高级路径缓存配置 | #### SimpleCache @@ -335,11 +335,30 @@ HSTS 配置 | :----------------- | ---- | :------------------------------------ | :--- | :----------------------------------------------------------- | | CacheRules | 是 | [SimpleCacheRule](#SimpleCacheRule)[] | | 缓存过期时间规则 | | FollowOrigin | 是 | string | | 遵循源站 Cache-Control: max-age 配置 on:开启 off:关闭 | -| IgnoreCacheControl | 是 | string | off | 强制缓存 on:开启 off:关闭,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | -| IgnoreSetCookie | 是 | string | off | 忽略源站的Set-Cookie头部 on:开启 off:关闭 | -| CompareMaxAge | 是 | string | off | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | +| IgnoreCacheControl | 是 | string | | 强制缓存 on:开启 off:关闭,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | +| IgnoreSetCookie | 是 | string | | 忽略源站的Set-Cookie头部 on:开启 off:关闭 | +| CompareMaxAge | 是 | string | | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | | Revalidate | 否 | [Revalidate](#Revalidate) | | 总是回源站校验 | +#### SimpleCacheRule + +缓存过期规则配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :------------ | ---- | :------- | :--- | :----------------------------------------------------------- | +| CacheType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | +| CacheContents | 是 | string[] | | CacheType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | +| CacheTime | 是 | number | | 缓存过期时间设置 单位为秒,最大可设置为 365 天 | + +#### Revalidate + +是否回源站校验 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----- | ---- | :----- | :--- | :------------------------- | +| Switch | 是 | String | | on \| off 是否总是回源校验 | +| Path | 否 | String | | 只在特定请求路径回源站校验 | + #### RuleCache 缓存配置分路径版本 @@ -350,6 +369,45 @@ HSTS 配置 | RuleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | | CacheConfig | 是 | [RuleCacheConfig](#RuleCacheConfig) | | 缓存配置 | +#### RuleCacheConfig + +路径缓存缓存配置(三种缓存模式中选取一种) + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----------- | ---- | :-------------------------------------------------- | :--- | :----------- | +| Cache | 是 | [CacheConfigCache](#CacheConfigCache) | | 缓存配置 | +| NoCache | 是 | [CacheConfigNoCache](#CacheConfigNoCache) | | 不缓存配置 | +| FollowOrigin | 是 | [CacheConfigFollowOrigin](#CacheConfigFollowOrigin) | | 遵循源站配置 | + +#### CacheConfigCache + +路径缓存缓存配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----------------- | ---- | :----- | :--- | :----------------------------------------------------------- | +| Switch | 是 | string | | 缓存配置开关 on:开启 off:关闭 | +| CacheTime | 是 | number | | 缓存过期时间设置 单位为秒,最大可设置为 365 天 | +| CompareMaxAge | 是 | string | | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | +| IgnoreCacheControl | 是 | string | | 强制缓存 on:开启 off:关闭 默认为关闭状态,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | +| IgnoreSetCookie | 是 | string | | 当源站返回Set-Cookie头部时,节点是否缓存该头部及body on:开启,不缓存该头部及body off:关闭,遵循用户自定义的节点缓存规则 | + +#### CacheConfigNoCache + +路径缓存不缓存配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :--------- | ---- | :----- | :--- | :-------------------------------- | +| Switch | 是 | string | | 不缓存配置开关 on:开启 off:关闭 | +| Revalidate | 是 | string | | 总是回源站校验 on:开启 off:关闭 | + +#### CacheConfigFollowOrigin + +路径缓存遵循源站配置 + +| 名称 | 必选 | 类型 | 默认 | 描述 | +| :----- | ---- | :----- | :--- | :---------------------------------- | +| Switch | 是 | string | | 遵循源站配置开关 on:开启 off:关闭 | + #### Referer Referer 黑白名单配置,默认为关闭状态 From 2f980c0dc2170ce3f98cb39338a2e1ef7aba77fb Mon Sep 17 00:00:00 2001 From: ciryu <35194652+ciryu@users.noreply.github.com> Date: Thu, 9 Dec 2021 11:01:37 +0800 Subject: [PATCH 18/20] docx:update configure description (#45) --- docs/configure.md | 190 +++++++++++++++++++++++----------------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/docs/configure.md b/docs/configure.md index d32d308..2278b76 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -188,16 +188,16 @@ global:全球加速 | 参数名称 | 必选 | 类型 | 默认 | 描述 | | -------------- | :--: | ------------------------- | ---- | ------------------------------------------------------------ | -| Switch | 是 | string | | https 配置开关。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | -| Http2 | 否 | string | | http2 配置开关。on: 开启;off:关闭;初次启用 https 加速会默认开启 http2 配置 | -| OcspStapling | 否 | string | off | OCSP 配置开关。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | -| VerifyClient | 否 | string | off | 客户端证书校验功能。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | -| CertInfo | 否 | [ServerCert](#ServerCert) | | 服务端证书配置信息 | -| ClientCertInfo | 否 | [ClientCert](#ClientCert) | | 客户端证书配置信息 | -| Spdy | 否 | string | off | Spdy 配置开关。on: 开启;off:关闭 | -| SslStatus | 否 | string | | https 证书部署状态。closed:已关闭;deploying:部署中;deployed:部署成功;failed:部署失败 | -| Hsts | 否 | [Hsts](#Hsts) | | Hsts配置 | -| TlsVersion | 否 | string[] | | Tls版本设置,仅支持部分Advance域名,支持设置 TLSv1, TLSV1.1, TLSV1.2, TLSv1.3,修改时必须开启连续的版本 | +| switch | 是 | string | | https 配置开关。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | +| http2 | 否 | string | | http2 配置开关。on: 开启;off:关闭;初次启用 https 加速会默认开启 http2 配置 | +| ocspStapling | 否 | string | off | OCSP 配置开关。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | +| verifyClient | 否 | string | off | 客户端证书校验功能。on: 开启;off:关闭;此字段可能返回 null,表示取不到有效值 | +| certInfo | 否 | [ServerCert](#ServerCert) | | 服务端证书配置信息 | +| clientCertInfo | 否 | [ClientCert](#ClientCert) | | 客户端证书配置信息 | +| spdy | 否 | string | off | Spdy 配置开关。on: 开启;off:关闭 | +| sslStatus | 否 | string | | https 证书部署状态。closed:已关闭;deploying:部署中;deployed:部署成功;failed:部署失败 | +| hsts | 否 | [Hsts](#Hsts) | | Hsts配置 | +| tlsVersion | 否 | string[] | | Tls版本设置,仅支持部分Advance域名,支持设置 TLSv1, TLSv1.1, TLSv1.2, TLSv1.3,修改时必须开启连续的版本 | #### ServerCert @@ -205,13 +205,13 @@ https 加速服务端证书配置 | 参数名称 | 必选 | 类型 | 默认 | 描述 | | :---------- | ---- | :-------- | ---- | :------------------------------------------------------ | -| CertId | 否 | string | | 服务器证书 ID 在 SSL 证书管理进行证书托管时自动生成 | -| CertName | 否 | string | | 服务器证书名称 在 SSL 证书管理进行证书托管时自动生成 | -| Certificate | 否 | string | | 服务器证书信息 上传自有证书时必填,需要包含完整的证书链 | -| PrivateKey | 否 | string | | 服务器密钥信息 上传自有证书时必填 | -| ExpireTime | 否 | timestamp | | 证书过期时间 作为入参配置时无需填充 | -| DeployTime | 否 | timestamp | | 证书颁发时间 作为入参配置时无需填充 | -| Message | 否 | string | | 证书备注信息 | +| certId | 否 | string | | 服务器证书 ID 在 SSL 证书管理进行证书托管时自动生成 | +| certName | 否 | string | | 服务器证书名称 在 SSL 证书管理进行证书托管时自动生成 | +| certificate | 否 | string | | 服务器证书信息 上传自有证书时必填,需要包含完整的证书链 | +| privateKey | 否 | string | | 服务器密钥信息 上传自有证书时必填 | +| expireTime | 否 | timestamp | | 证书过期时间 作为入参配置时无需填充 | +| deployTime | 否 | timestamp | | 证书颁发时间 作为入参配置时无需填充 | +| message | 否 | string | | 证书备注信息 | #### ClientCert @@ -219,10 +219,10 @@ https 客户端证书配置 | 参数名称 | 必选 | 类型 | 默认 | 描述 | | :---------- | ---- | :-------- | ---- | :----------------------------------------- | -| Certificate | 是 | string | | 客户端证书 PEM 格式,需要进行 Base 64 编码 | -| CertName | 否 | string | | 客户端证书名称 | -| ExpireTime | 否 | timestamp | | 证书过期时间 作为入参时无需填充 | -| DeployTime | 否 | timestamp | | 证书颁发时间 作为入参时无需填充 | +| certificate | 是 | string | | 客户端证书 PEM 格式,需要进行 Base 64 编码 | +| certName | 否 | string | | 客户端证书名称 | +| expireTime | 否 | timestamp | | 证书过期时间 作为入参时无需填充 | +| deployTime | 否 | timestamp | | 证书颁发时间 作为入参时无需填充 | #### Hsts @@ -230,9 +230,9 @@ HSTS 配置 | 参数名称 | 必选 | 类型 | 默认 | 描述 | | :---------------- | ---- | :----- | ---- | :---------------------- | -| Switch | 是 | string | | 是否开启,on或off。 | -| MaxAge | 否 | number | | MaxAge数值 | -| IncludeSubDomains | 否 | string | | 是否包含子域名,on或off | +| switch | 是 | string | | 是否开启,on或off。 | +| maxAge | 否 | number | | MaxAge数值 | +| includeSubDomains | 否 | string | | 是否包含子域名,on或off | #### CacheKey @@ -240,14 +240,14 @@ HSTS 配置 | 参数名称 | 必选 | 类型 | 默认 | 描述 | | :----------- | ---- | :-------------------------------- | ---- | :----------------------------------------------------------- | -| FullUrlCache | 否 | string | | 是否开启全路径缓存 on:开启全路径缓存(即关闭参数忽略) off:关闭全路径缓存(即开启参数忽略) | -| IgnoreCase | 否 | string | | 是否忽略大小写缓存 | -| Querystring | 否 | [QuerystringKey](#QuerystringKey) | | CacheKey中包含请求参数 | -| Cookie | 否 | [CookieKey](#CookieKey) | | CacheKey中包含Cookie | -| Header | 否 | [HeaderKey](#HeaderKey) | | CacheKey中包含请求头部 | -| CacheTag | 否 | [CacheTagKey](#CacheTagKey) | | CacheKey中包含自定义字符串 | -| Scheme | 否 | [SchemeKey](#SchemeKey) | | CacheKey中包含请求协议 | -| KeyRules | 否 | [KeyRule](#KeyRule)[] | | 分路径缓存键配置 | +| fullUrlCache | 否 | string | | 是否开启全路径缓存 on:开启全路径缓存(即关闭参数忽略) off:关闭全路径缓存(即开启参数忽略) | +| ignoreCase | 否 | string | | 是否忽略大小写缓存 | +| querystring | 否 | [QuerystringKey](#QuerystringKey) | | CacheKey中包含请求参数 | +| cookie | 否 | [CookieKey](#CookieKey) | | CacheKey中包含Cookie | +| header | 否 | [HeaderKey](#HeaderKey) | | CacheKey中包含请求头部 | +| cacheTag | 否 | [CacheTagKey](#CacheTagKey) | | CacheKey中包含自定义字符串 | +| scheme | 否 | [SchemeKey](#SchemeKey) | | CacheKey中包含请求协议 | +| keyRules | 否 | [KeyRule](#KeyRule)[] | | 分路径缓存键配置 | #### QuerystringKey @@ -255,10 +255,10 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :------ | ---- | :----- | :--- | :----------------------------------------------------------- | -| Switch | 是 | string | | on \| off CacheKey是否由Querystring组成 | -| Reorder | 否 | string | | 是否重新排序 | -| Action | 否 | string | | includeAll \| excludeAll \| includeCustom \| excludeAll 使用/排除部分url参数 | -| Value | 否 | string | | 使用/排除的url参数数组,';' 分割 | +| switch | 是 | string | | on \| off CacheKey是否由Querystring组成 | +| reorder | 否 | string | | 是否重新排序 | +| action | 否 | string | | includeAll \| excludeAll \| includeCustom \| excludeAll 使用/排除部分url参数 | +| value | 否 | string | | 使用/排除的url参数数组,';' 分割 | #### CookieKey @@ -266,8 +266,8 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----- | ---- | :----- | :--- | :---------------------------------------- | -| Switch | 是 | string | | on \| off 是否使用Cookie作为Cache的一部分 | -| Value | 否 | string | | 使用的cookie,';' 分割 | +| switch | 是 | string | | on \| off 是否使用Cookie作为Cache的一部分 | +| value | 否 | string | | 使用的cookie,';' 分割 | #### HeaderKey @@ -275,8 +275,8 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----- | ---- | :----- | :--- | :--------------------------------- | -| Switch | 否 | string | | 是否组成Cachekey | -| Value | 否 | string | | 组成CacheKey的header数组,';' 分割 | +| switch | 否 | string | | 是否组成Cachekey | +| value | 否 | string | | 组成CacheKey的header数组,';' 分割 | #### CacheTagKey @@ -284,8 +284,8 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----- | ---- | :----- | :--- | :----------------------------------- | -| Switch | 是 | string | | 是否使用CacheTag作为CacheKey的一部分 | -| Value | 否 | string | | 自定义CacheTag的值 | +| switch | 是 | string | | 是否使用CacheTag作为CacheKey的一部分 | +| value | 否 | string | | 自定义CacheTag的值 | #### SchemeKey @@ -293,7 +293,7 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----- | ---- | :----- | :--- | :-------------------------------------------- | -| Switch | 是 | string | | on \| off 是否使用scheme作为cache key的一部分 | +| switch | 是 | string | | on \| off 是否使用scheme作为cache key的一部分 | #### KeyRule @@ -301,12 +301,12 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----------- | ---- | :---------------------------------- | :--- | :----------------------------------------------------------- | -| RulePaths | 是 | string[] | | CacheType 对应类型下的匹配内容: file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | -| RuleType | 是 | string | | 规则类型: file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | -| FullUrlCache | 是 | string | | 是否开启全路径缓存 on:开启全路径缓存(即关闭参数忽略) off:关闭全路径缓存(即开启参数忽略) | -| IgnoreCase | 是 | string | | 是否忽略大小写缓存 | -| Querystring | 是 | [RuleQuerystring](#RuleQuerystring) | | CacheKey中包含请求参数 | -| RuleTag | 是 | string | | 路径缓存键标签,传 user | +| rulePaths | 是 | string[] | | CacheType 对应类型下的匹配内容: file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | +| ruleType | 是 | string | | 规则类型: file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | +| fullUrlCache | 是 | string | | 是否开启全路径缓存 on:开启全路径缓存(即关闭参数忽略) off:关闭全路径缓存(即开启参数忽略) | +| ignoreCase | 是 | string | | 是否忽略大小写缓存 | +| querystring | 是 | [RuleQuerystring](#RuleQuerystring) | | CacheKey中包含请求参数 | +| ruleTag | 是 | string | | 路径缓存键标签,传 user | #### RuleQuerystring @@ -314,9 +314,9 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----- | ---- | :----- | :--- | :-------------------------------------- | -| Switch | 是 | string | | on \| off CacheKey是否由Querystring组成 | -| Action | 是 | string | | includeCustom 包含部分url参数 | -| Value | 是 | string | | 使用/排除的url参数数组,';' 分割 | +| switch | 是 | string | | on \| off CacheKey是否由Querystring组成 | +| action | 是 | string | | includeCustom 包含部分url参数 | +| value | 是 | string | | 使用/排除的url参数数组,';' 分割 | #### Cache @@ -324,8 +324,8 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :---------- | ---- | :----------------------------------------------------------- | :--- | :------------------- | -| SimpleCache | 否 | [SimpleCache](#SimpleCache) | | 基础缓存过期时间配置 | -| RuleCache | 否 | [RuleCache](#RuleCache)[] | | 高级路径缓存配置 | +| simpleCache | 否 | [SimpleCache](#SimpleCache) | | 基础缓存过期时间配置 | +| ruleCache | 否 | [RuleCache](#RuleCache)[] | | 高级路径缓存配置 | #### SimpleCache @@ -333,12 +333,12 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----------------- | ---- | :------------------------------------ | :--- | :----------------------------------------------------------- | -| CacheRules | 是 | [SimpleCacheRule](#SimpleCacheRule)[] | | 缓存过期时间规则 | -| FollowOrigin | 是 | string | | 遵循源站 Cache-Control: max-age 配置 on:开启 off:关闭 | -| IgnoreCacheControl | 是 | string | | 强制缓存 on:开启 off:关闭,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | -| IgnoreSetCookie | 是 | string | | 忽略源站的Set-Cookie头部 on:开启 off:关闭 | -| CompareMaxAge | 是 | string | | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | -| Revalidate | 否 | [Revalidate](#Revalidate) | | 总是回源站校验 | +| cacheRules | 是 | [SimpleCacheRule](#SimpleCacheRule)[] | | 缓存过期时间规则 | +| followOrigin | 是 | string | | 遵循源站 Cache-Control: max-age 配置 on:开启 off:关闭 | +| ignoreCacheControl | 是 | string | | 强制缓存 on:开启 off:关闭,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | +| ignoreSetCookie | 是 | string | | 忽略源站的Set-Cookie头部 on:开启 off:关闭 | +| compareMaxAge | 是 | string | | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | +| revalidate | 否 | [Revalidate](#Revalidate) | | 总是回源站校验 | #### SimpleCacheRule @@ -346,9 +346,9 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :------------ | ---- | :------- | :--- | :----------------------------------------------------------- | -| CacheType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | -| CacheContents | 是 | string[] | | CacheType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | -| CacheTime | 是 | number | | 缓存过期时间设置 单位为秒,最大可设置为 365 天 | +| cacheType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | +| cacheContents | 是 | string[] | | CacheType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | +| cacheTime | 是 | number | | 缓存过期时间设置 单位为秒,最大可设置为 365 天 | #### Revalidate @@ -356,8 +356,8 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----- | ---- | :----- | :--- | :------------------------- | -| Switch | 是 | String | | on \| off 是否总是回源校验 | -| Path | 否 | String | | 只在特定请求路径回源站校验 | +| switch | 是 | String | | on \| off 是否总是回源校验 | +| path | 否 | String | | 只在特定请求路径回源站校验 | #### RuleCache @@ -365,9 +365,9 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :---------- | ---- | :---------------------------------- | :--- | :----------------------------------------------------------- | -| RulePaths | 是 | string[] | | CacheType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | -| RuleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | -| CacheConfig | 是 | [RuleCacheConfig](#RuleCacheConfig) | | 缓存配置 | +| rulePaths | 是 | string[] | | CacheType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test path 时填充绝对路径,如 /xxx/test.html index 时填充 / | +| ruleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 index:首页 | +| cacheConfig | 是 | [RuleCacheConfig](#RuleCacheConfig) | | 缓存配置 | #### RuleCacheConfig @@ -375,9 +375,9 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----------- | ---- | :-------------------------------------------------- | :--- | :----------- | -| Cache | 是 | [CacheConfigCache](#CacheConfigCache) | | 缓存配置 | -| NoCache | 是 | [CacheConfigNoCache](#CacheConfigNoCache) | | 不缓存配置 | -| FollowOrigin | 是 | [CacheConfigFollowOrigin](#CacheConfigFollowOrigin) | | 遵循源站配置 | +| cache | 是 | [CacheConfigCache](#CacheConfigCache) | | 缓存配置 | +| noCache | 是 | [CacheConfigNoCache](#CacheConfigNoCache) | | 不缓存配置 | +| followOrigin | 是 | [CacheConfigFollowOrigin](#CacheConfigFollowOrigin) | | 遵循源站配置 | #### CacheConfigCache @@ -385,11 +385,11 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----------------- | ---- | :----- | :--- | :----------------------------------------------------------- | -| Switch | 是 | string | | 缓存配置开关 on:开启 off:关闭 | -| CacheTime | 是 | number | | 缓存过期时间设置 单位为秒,最大可设置为 365 天 | -| CompareMaxAge | 是 | string | | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | -| IgnoreCacheControl | 是 | string | | 强制缓存 on:开启 off:关闭 默认为关闭状态,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | -| IgnoreSetCookie | 是 | string | | 当源站返回Set-Cookie头部时,节点是否缓存该头部及body on:开启,不缓存该头部及body off:关闭,遵循用户自定义的节点缓存规则 | +| switch | 是 | string | | 缓存配置开关 on:开启 off:关闭 | +| cacheTime | 是 | number | | 缓存过期时间设置 单位为秒,最大可设置为 365 天 | +| compareMaxAge | 是 | string | | 高级缓存过期配置,开启时会对比源站返回的 max-age 值与 CacheRules 中设置的缓存过期时间,取最小值在节点进行缓存 on:开启 off:关闭 | +| ignoreCacheControl | 是 | string | | 强制缓存 on:开启 off:关闭 默认为关闭状态,开启后,源站返回的 no-store、no-cache 资源,也将按照 CacheRules 规则进行缓存 | +| ignoreSetCookie | 是 | string | | 当源站返回Set-Cookie头部时,节点是否缓存该头部及body on:开启,不缓存该头部及body off:关闭,遵循用户自定义的节点缓存规则 | #### CacheConfigNoCache @@ -397,8 +397,8 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :--------- | ---- | :----- | :--- | :-------------------------------- | -| Switch | 是 | string | | 不缓存配置开关 on:开启 off:关闭 | -| Revalidate | 是 | string | | 总是回源站校验 on:开启 off:关闭 | +| switch | 是 | string | | 不缓存配置开关 on:开启 off:关闭 | +| revalidate | 是 | string | | 总是回源站校验 on:开启 off:关闭 | #### CacheConfigFollowOrigin @@ -406,7 +406,7 @@ HSTS 配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----- | ---- | :----- | :--- | :---------------------------------- | -| Switch | 是 | string | | 遵循源站配置开关 on:开启 off:关闭 | +| switch | 是 | string | | 遵循源站配置开关 on:开启 off:关闭 | #### Referer @@ -414,8 +414,8 @@ Referer 黑白名单配置,默认为关闭状态 | 名称 | 必选 | 类型 | 默认 | 描述 | | :----------- | ---- | :---------------------------- | :--- | :------------------------------------------ | -| Switch | 是 | string | | referer 黑白名单配置开关 on:开启 off:关闭 | -| RefererRules | 否 | [RefererRule](#RefererRule)[] | | referer 黑白名单配置规则 | +| switch | 是 | string | | referer 黑白名单配置开关 on:开启 off:关闭 | +| refererRules | 否 | [RefererRule](#RefererRule)[] | | referer 黑白名单配置规则 | #### RefererRule @@ -423,11 +423,11 @@ Referer 黑白名单配置规则,针对特定资源生效 | 名称 | 必选 | 类型 | 默认 | 描述 | | :---------- | ---- | :------- | :--- | :----------------------------------------------------------- | -| RuleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 | -| RulePaths | 是 | string[] | | RuleType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test/ path 时填充绝对路径,如 /xxx/test.html | -| RefererType | 是 | string | | referer 配置类型 whitelist:白名单 blacklist:黑名单 | -| Referers | 是 | string[] | | referer 内容列表列表 | -| AllowEmpty | 是 | Boolean | | 是否允许空 referer true:允许空 referer false:不允许空 referer | +| ruleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 | +| rulePaths | 是 | string[] | | RuleType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test/ path 时填充绝对路径,如 /xxx/test.html | +| refererType | 是 | string | | referer 配置类型 whitelist:白名单 blacklist:黑名单 | +| referers | 是 | string[] | | referer 内容列表列表 | +| allowEmpty | 是 | Boolean | | 是否允许空 referer true:允许空 referer false:不允许空 referer | #### IpFilter @@ -435,11 +435,11 @@ IP 黑白名单配置,默认为关闭状态 | 名称 | 必选 | 类型 | 默认 | 描述 | | :---------- | ---- | :-------------------------------------- | :--- | :----------------------------------------------------------- | -| Switch | 是 | string | | IP 黑白名单配置开关 on:开启 off:关闭 | -| FilterType | 否 | string | | IP 黑白名单类型 whitelist:白名单 blacklist:黑名单 | -| Filters | 否 | string[] | | IP 黑白名单列表 支持 X.X.X.X 形式 IP,或 /8、 /16、/24 形式网段 最多可填充 50 个白名单或 50 个黑名单 | -| FilterRules | 否 | [IpFilterPathRule](#IpFilterPathRule)[] | | IP 黑白名单分路径配置,白名单功能 | -| ReturnCode | 否 | number | | IP 黑白名单验证失败时返回的 HTTP Code 合法值: 400~499 | +| switch | 是 | string | | IP 黑白名单配置开关 on:开启 off:关闭 | +| filterType | 否 | string | | IP 黑白名单类型 whitelist:白名单 blacklist:黑名单 | +| filters | 否 | string[] | | IP 黑白名单列表 支持 X.X.X.X 形式 IP,或 /8、 /16、/24 形式网段 最多可填充 50 个白名单或 50 个黑名单 | +| filterRules | 否 | [IpFilterPathRule](#IpFilterPathRule)[] | | IP 黑白名单分路径配置,白名单功能 | +| returnCode | 否 | number | | IP 黑白名单验证失败时返回的 HTTP Code 合法值: 400~499 | #### IpFilterPathRule @@ -447,10 +447,10 @@ IP黑白名单分路径配置 | 名称 | 必选 | 类型 | 默认 | 描述 | | :--------- | ---- | :------- | :--- | :----------------------------------------------------------- | -| FilterType | 是 | string | | IP 黑白名单类型 whitelist:白名单 blacklist:黑名单 | -| Filters | 是 | string[] | | IP 黑白名单列表 支持 X.X.X.X 形式 IP,或 /8、 /16、/24 形式网段 最多可填充 50 个白名单或 50 个黑名单 | -| RuleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 | -| RulePaths | 是 | string[] | | RuleType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test/ path 时填充绝对路径,如 /xxx/test.html | +| filterType | 是 | string | | IP 黑白名单类型 whitelist:白名单 blacklist:黑名单 | +| filters | 是 | string[] | | IP 黑白名单列表 支持 X.X.X.X 形式 IP,或 /8、 /16、/24 形式网段 最多可填充 50 个白名单或 50 个黑名单 | +| ruleType | 是 | string | | 规则类型: all:所有文件生效 file:指定文件后缀生效 directory:指定路径生效 path:指定绝对路径生效 | +| rulePaths | 是 | string[] | | RuleType 对应类型下的匹配内容: all 时填充 * file 时填充后缀名,如 jpg、txt directory 时填充路径,如 /xxx/test/ path 时填充绝对路径,如 /xxx/test.html | ### Env From 6fa6d0bc17242f8eaff6153696302bf46e7ad3a7 Mon Sep 17 00:00:00 2001 From: Rong <58057861+Rong5180@users.noreply.github.com> Date: Fri, 18 Mar 2022 10:04:37 +0800 Subject: [PATCH 19/20] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=BF=87=E5=A4=9A=E4=B8=8A=E4=BC=A0=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=20(#46)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: rongxwang --- serverless.component.yml | 2 +- src/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/serverless.component.yml b/serverless.component.yml index 02c9ad8..65ee942 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: website -version: 0.2.4 +version: 0.2.6 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: 静态网站组件,允许用户构建部署静态站点到腾讯 COS。适合用来构建部署静态网站。 diff --git a/src/package.json b/src/package.json index 4ef9d4c..bcc427a 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^2.13.4" + "tencent-component-toolkit": "^2.23.3" } } From e94c53d7517e3cb008282b88fd5ab77398ae8e0b Mon Sep 17 00:00:00 2001 From: slsplus Date: Fri, 18 Mar 2022 02:05:52 +0000 Subject: [PATCH 20/20] chore(release): version 0.2.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [0.2.4](https://github.com/serverless-components/tencent-website/compare/v0.2.3...v0.2.4) (2022-03-18) ### Bug Fixes * 修改文件过多上传失败 ([#46](https://github.com/serverless-components/tencent-website/issues/46)) ([6fa6d0b](https://github.com/serverless-components/tencent-website/commit/6fa6d0bc17242f8eaff6153696302bf46e7ad3a7)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e96c22e..49e1086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.2.4](https://github.com/serverless-components/tencent-website/compare/v0.2.3...v0.2.4) (2022-03-18) + + +### Bug Fixes + +* 修改文件过多上传失败 ([#46](https://github.com/serverless-components/tencent-website/issues/46)) ([6fa6d0b](https://github.com/serverless-components/tencent-website/commit/6fa6d0bc17242f8eaff6153696302bf46e7ad3a7)) + ## [0.2.2](https://github.com/serverless-components/tencent-website/compare/v0.2.1...v0.2.2) (2021-07-29)