geqintan commited on
Commit
59cffd0
·
1 Parent(s): 1ed6f05
Dockerfile CHANGED
@@ -33,6 +33,7 @@ USER myuser
33
  COPY app.lua /data/myapp/
34
  # COPY app_v1.lua /data/myapp/
35
  COPY get_ups.lua /usr/local/openresty/nginx/
 
36
  COPY app /data/myapp/app
37
  COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
38
 
 
33
  COPY app.lua /data/myapp/
34
  # COPY app_v1.lua /data/myapp/
35
  COPY get_ups.lua /usr/local/openresty/nginx/
36
+ COPY get_will_trim_path.lua /usr/local/openresty/nginx/
37
  COPY app /data/myapp/app
38
  COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
39
 
bak/2025-02-26 0003 实现静态gemini访问,cline可用/nginx.conf CHANGED
@@ -16,8 +16,10 @@ http {
16
  server_name localhost;
17
 
18
  location / {
19
-
20
  default_type text/html;
 
 
 
21
  rewrite ^/v1/https/generativelanguage.googleapis.com/(.*)$ /$1 break; # 裁剪路径
22
  proxy_pass https://generativelanguage.googleapis.com/;
23
  proxy_set_header Host generativelanguage.googleapis.com;
 
16
  server_name localhost;
17
 
18
  location / {
 
19
  default_type text/html;
20
+
21
+
22
+
23
  rewrite ^/v1/https/generativelanguage.googleapis.com/(.*)$ /$1 break; # 裁剪路径
24
  proxy_pass https://generativelanguage.googleapis.com/;
25
  proxy_set_header Host generativelanguage.googleapis.com;
get_will_trim_path.lua ADDED
@@ -0,0 +1 @@
 
 
1
+ return "v1/https/generativelanguage.googleapis.com"
nginx.conf CHANGED
@@ -17,7 +17,12 @@ http {
17
 
18
  location / {
19
  default_type text/html;
20
- rewrite ^/v1/https/generativelanguage.googleapis.com/(.*)$ /$1 break; # 裁剪路径
 
 
 
 
 
21
  proxy_pass https://generativelanguage.googleapis.com/;
22
  proxy_set_header Host generativelanguage.googleapis.com;
23
  # 设置其他常用的请求头
 
17
 
18
  location / {
19
  default_type text/html;
20
+
21
+ # 获得需要裁剪掉的路径,比如:/v1/https/generativelanguage.googleapis.com/
22
+ set_by_lua_file $will_trim_path get_will_trim_path.lua;
23
+
24
+ # rewrite ^/v1/https/generativelanguage.googleapis.com/(.*)$ /$1 break; # 裁剪路径
25
+ rewrite ^/$will_trim_path/(.*)$ /$1 break; # 裁剪路径
26
  proxy_pass https://generativelanguage.googleapis.com/;
27
  proxy_set_header Host generativelanguage.googleapis.com;
28
  # 设置其他常用的请求头