Skip to content

Commit 40ceccc

Browse files
committed
add cors doc
1 parent 6709ff5 commit 40ceccc

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

config.release.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
## directory to store static web files. if you use docker, please mount a persistence volume for it.
22
file_dir = "/data"
33

4-
## enable cors, default is false, its implementation is simple now.
4+
## enable cors, default is none, when set '*', then all cors is ok.
55
## Access-Control-Allow-Origin: $ORIGIN
66
## Access-Control-Allow-Methods: OPTION,GET,HEAD
77
## Access-Control-Max-Age: 3600
8-
## If you put the server behind HTTPS proxy, please enable it
9-
cors = false
8+
## If you put the server behind HTTPS proxy, please enable it, or domains.cors = ['?']
9+
## Attension: domains.cors would overwrite the cors config, rather than merge this.
10+
cors = ['*']
1011
## http bind, if set port <= 0 or remove http, will disable http server(need set https config)
1112
[http]
1213
port = 80
1314
addr = "0.0.0.0"
14-
## port when serving public PI,default is http port. external_port should not be 0.
15+
## port when serving public network,default is http port. external_port should not be 0.
1516
# external_port = 80
1617

1718
## optional, when https enabled, redirect_https default value true
@@ -21,7 +22,7 @@ addr = "0.0.0.0"
2122
# [https]
2223
# port = 443 # https bind address
2324
# addr = "0.0.0.0"
24-
## port when serving public PI,default is https port. external_port should not be 0.
25+
## port when serving public network,default is https port. external_port should not be 0.
2526
# external_port = 443
2627

2728
## if set true, http server(80) will send client
@@ -89,7 +90,7 @@ addr = "0.0.0.0"
8990
# domain = "www.example.com"
9091
## optional, `example.com` would redirect to `www.example.com`
9192
# alias = ["example.com"]
92-
# cors = false
93+
# cors = ['https://www.example.com', 'http://www.baidu.com']
9394
# [domains.https]
9495
## optional, when https enabled, redirect_https default value true
9596
## it would the port would be https.external_port(https.external_port should be defined), otherwise is false
@@ -106,7 +107,6 @@ addr = "0.0.0.0"
106107
# expire = '30d' # 30day
107108
# extension_names = ['icon', 'gif', 'jpg', 'jpeg', 'png', 'js']
108109

109-
[openTelemetry]
110-
endpoint = "http://localhost:4317"
111-
112110

111+
# [openTelemetry]
112+
# endpoint = "http://localhost:4317"

docs/develop/change-log.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
### Version 2.4.1
4+
- spa-server: `cors` value bool to array string.
5+
36
### Version 2.4.0
47

58
- improve: extract client and server common entity

docs/guide/break-changes.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Break Changes
2-
## V2.4.0
2+
## V2.4.1
3+
* spa-server: `cors` value bool to array string.
4+
## V2.4.0(2024-08-04)
35
* remove hocon config format, change to toml.
46
## V2.3.0(2024-07-01)
57
* spa-server: `https.http_redirect_to_https` move to `http.redirect_https`, and value is bool.

docs/guide/spa-server-configuration.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ The config default path is `./config.toml`, you can change it by environment `SP
1414
## directory to store static web files. if you use docker, please mount a persistence volume for it.
1515
file_dir = "/data"
1616

17-
## enable cors, default is false, its implementation is simple now.
17+
## enable cors, default is none, when set '*', then all cors is ok.
1818
## Access-Control-Allow-Origin: $ORIGIN
1919
## Access-Control-Allow-Methods: OPTION,GET,HEAD
2020
## Access-Control-Max-Age: 3600
21-
## If you put the server behind HTTPS proxy, please enable it
22-
cors = false
21+
## If you put the server behind HTTPS proxy, please enable it, or domains.cors = ['?']
22+
## Attension: domains.cors would overwrite the cors config, rather than merge this.
23+
cors = ['*']
2324
## http bind, if set port <= 0 or remove http, will disable http server(need set https config)
2425
[http]
2526
port = 80
2627
addr = "0.0.0.0"
27-
## port when serving public PI,default is http port. external_port should not be 0.
28+
## port when serving public network,default is http port. external_port should not be 0.
2829
# external_port = 80
2930

3031
## optional, when https enabled, redirect_https default value true
@@ -34,7 +35,7 @@ addr = "0.0.0.0"
3435
# [https]
3536
# port = 443 # https bind address
3637
# addr = "0.0.0.0"
37-
## port when serving public PI,default is https port. external_port should not be 0.
38+
## port when serving public network,default is https port. external_port should not be 0.
3839
# external_port = 443
3940

4041
## if set true, http server(80) will send client
@@ -102,7 +103,7 @@ addr = "0.0.0.0"
102103
# domain = "www.example.com"
103104
## optional, `example.com` would redirect to `www.example.com`
104105
# alias = ["example.com"]
105-
# cors = false
106+
# cors = ['https://www.example.com', 'http://www.baidu.com']
106107
# [domains.https]
107108
## optional, when https enabled, redirect_https default value true
108109
## it would the port would be https.external_port(https.external_port should be defined), otherwise is false

0 commit comments

Comments
 (0)