Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfede783

Browse files
authored
Merge pull request#925 from http-party/fix-cors-documentation
Fix CORS option documentation to match actual behavior
2 parents9d7dd6b +360b798 commitfede783

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ with the provided Dockerfile.
6969
|`-b` or`--brotli`|When enabled it will serve`./public/some-file.js.br` in place of`./public/some-file.js` when a brotli compressed version of the file exists and the request accepts`br` encoding. If gzip is also enabled, it will try to serve brotli first.|`false`|
7070
|`-e` or`--ext`|Default file extension if none supplied|`html`|
7171
|`-s` or`--silent`|Suppress log messages from output||
72-
|`--cors`|Enable CORS via the`Access-Control-Allow-Origin` header||
72+
|`--cors`|Enable CORS via the`Access-Control-Allow-Origin: *` header. Optionally provide comma-separated values to add to`Access-Control-Allow-Headers`||
7373
|`-H` or`--header`|Add an extra response header (can be used several times)||
7474
|`-o [path]`|Open browser window after starting the server. Optionally provide a URL path to open. e.g.: -o /other/dir/||
7575
|`-c`|Set cache time (in seconds) for cache-control max-age header, e.g.`-c10` for 10 seconds. To disable caching, use`-c-1`.|`3600`|

‎bin/http-server‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ if (argv.h || argv.help) {
3636
' -e --ext Default file extension if none supplied [none]',
3737
' -s --silent Suppress log messages from output',
3838
' --cors[=headers] Enable CORS via the "Access-Control-Allow-Origin" header',
39-
' Optionally provide CORS headers list separated by commas',
39+
' When enabled, sets Access-Control-Allow-Origin to "*"',
40+
' Optional value adds to Access-Control-Allow-Headers',
4041
' -H',
4142
' --header',
4243
' Add an extra response header (can be used several times)',

‎doc/http-server.1‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ Suppress log messages from output.
5959

6060
.TP
6161
.BI\-\-cors"" [\fIHEADERS\fR]
62-
Enable CORS via the "Access-Control-Allow-Origin" header.
63-
Optionally provide CORS headers list separated by commas.
62+
Enable CORS by setting "Access-Control-Allow-Origin" to "*".
63+
Optional comma-separated headers list adds to "Access-Control-Allow-Headers".
64+
Default Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Range.
6465

6566
.TP
6667
.BI\-H","\-\-header""\fIHEADER\fR

‎lib/http-server.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ function HttpServer(options) {
9898
});
9999
}
100100

101+
// CORS configuration:
102+
// --cors enables CORS by setting Access-Control-Allow-Origin to '*'
103+
// --cors=header1,header2 also adds custom headers to Access-Control-Allow-Headers
101104
if(options.cors){
102105
this.headers['Access-Control-Allow-Origin']='*';
103106
this.headers['Access-Control-Allow-Headers']='Origin, X-Requested-With, Content-Type, Accept, Range';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp