Skip to content

Commit

Permalink
fix: fallback login API to worker on no-cors mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoOwO authored Oct 6, 2024
1 parent a7462f5 commit 4b81f34
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sub_filter '</body>' '<script src="https://jellyfin-danmaku.pages.dev/ede.user.j
sub_filter_once on;
```

並加入一個新的 location 塊:
並加入新的 location 塊:
```conf
location /ddplay-api/ {
proxy_pass https://api.dandanplay.net/;
Expand All @@ -84,6 +84,30 @@ location /ddplay-api/ {
return 204;
}
}
location /ddplay-api/ {
proxy_pass https://api.dandanplay.net/;
proxy_set_header Host $host;
add_header Access-Control-Allow-Origin "example.com";
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization";
if ($request_method = OPTIONS) {
add_header Content-Length 0;
add_header Content-Type text/plain;
return 204;
}
}
location /ddplay-api/api/v2/login {
proxy_pass https://jellyfin-danmaku.pages.dev;
proxy_set_header Host $host;
add_header Access-Control-Allow-Origin "example.com";
add_header Access-Control-Allow-Methods "POST, OPTIONS";
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization";
}
```

- [`完整示例`](https://github.com/Izumiko/jellyfin-danmaku/issues/8)
Expand All @@ -110,6 +134,14 @@ example.com {
header_up Accept-Encoding identity
}
handle_path /ddplay-api/api/v2/login* {
reverse_proxy https://jellyfin-danmaku.pages.dev {
header_down Access-Control-Allow-Origin "example.com"
header_down Access-Control-Allow-Methods "POST, OPTIONS"
header_down Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization"
}
}
handle_path /ddplay-api/* {
reverse_proxy https://api.dandanplay.net {
header_down Access-Control-Allow-Origin "example.com"
Expand Down

0 comments on commit 4b81f34

Please sign in to comment.