diff --git a/mytv/nginx.conf b/mytv/nginx.conf index 143bbc3..27805b9 100644 --- a/mytv/nginx.conf +++ b/mytv/nginx.conf @@ -70,6 +70,12 @@ http { #"abc" 1; # 可选:支持多个 token } + # 去除 token 参数,保留其他参数 + map $args $args_clean { + default $args; + ~^(.*)(^|&)token=[^&]*&?(.*)$ $1$3; + } + server { listen 20000; listen [::]:20000; @@ -116,6 +122,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn.16899.ggff.net; # 替换为您的源站地址 @@ -129,6 +136,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn.16899.ggff.net; # 替换为您的源站地址 @@ -183,6 +191,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://live.cdn.com.mp; # 替换为您的源站地址 @@ -196,6 +205,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://live.cdn.com.mp; # 替换为您的源站地址 @@ -250,26 +260,12 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://smt.1789.dpdns.org; # 替换为您的源站地址 } - # 针对 .ts 和 .aac 文件的特殊缓存设置 - location ~* \.(ts|aac)$ { - if ($auth_ok = 0) { - return 302 https://cdn.1678520.xyz/403?mytv; - } - - if ($arg_token) { - add_header Set-Cookie "token=$arg_token; Path=/"; - } - - proxy_pass https://smt.1789.dpdns.org; # 替换为您的源站地址 - proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒 - expires 60s; # 设置浏览器端缓存 60 秒 - } - # 针对包含 smt2.1.5.php 的 URL,设置缓存时间为 60 秒 location ~ smt2\.1\.5\.php { if ($auth_ok = 0) { @@ -278,6 +274,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_cache_valid 200 206 60s; # 缓存 60 秒 @@ -332,6 +329,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn6.16899.ggff.net; # 替换为您的源站地址 @@ -345,6 +343,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn6.16899.ggff.net; # 替换为您的源站地址 @@ -399,6 +398,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass http://v2h.1789.dpdns.org; # 替换为您的源站地址 @@ -412,6 +412,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass http://v2h.1789.dpdns.org; # 替换为您的源站地址 @@ -466,6 +467,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://live.tvfix.org; # 替换为您的源站地址 @@ -479,6 +481,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://live.tvfix.org; # 替换为您的源站地址 @@ -533,6 +536,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn5.zone.id; # 替换为您的源站地址 @@ -546,6 +550,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn5.zone.id; # 替换为您的源站地址 @@ -601,6 +606,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn2.16899.ggff.net; # 替换为您的源站地址 @@ -614,6 +620,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn2.16899.ggff.net; # 替换为您的源站地址 @@ -668,6 +675,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass http://aktv_stream.m16tv.cfd; # 替换为您的源站地址 @@ -681,6 +689,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass http://aktv_stream.m16tv.cfd; @@ -710,6 +719,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass http://aktv_stream.m16tv.cfd; @@ -772,6 +782,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn8.zone.id; # 替换为您的源站地址 @@ -785,6 +796,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://cdn8.zone.id; # 替换为您的源站地址 @@ -838,6 +850,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://mytv.cdn.com.mp; # 替换为您的源站地址 @@ -852,6 +865,7 @@ http { if ($arg_token) { add_header Set-Cookie "token=$arg_token; Path=/"; + return 302 $uri?$args_clean; } proxy_pass https://hw.1678520.xyz/;