浏览代码

Renames the $upstream variables and does not append $request_ui if capture group exists in location

Julian Reinhardt 4 年之前
父节点
当前提交
3d80759a21
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      backend/templates/_location.conf
  2. 2 2
      docker/rootfs/etc/nginx/conf.d/include/proxy.conf

+ 2 - 2
backend/templates/_location.conf

@@ -1,11 +1,11 @@
   location {{ path }} {
-    set              $upstream {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}$request_uri;
+    set              $targetUri {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}{% unless path contains "(" %}$request_uri{% endunless %};
     proxy_set_header Host $host;
     proxy_set_header X-Forwarded-Scheme $scheme;
     proxy_set_header X-Forwarded-Proto  $scheme;
     proxy_set_header X-Forwarded-For    $remote_addr;
     proxy_set_header X-Real-IP		$remote_addr;
-    proxy_pass       $upstream;
+    proxy_pass       $targetUri;
 
     {% if access_list_id > 0 %}
     {% if access_list.items.length > 0 %}

+ 2 - 2
docker/rootfs/etc/nginx/conf.d/include/proxy.conf

@@ -1,9 +1,9 @@
-set              $upstream $forward_scheme://$server:$port$request_uri;
+set              $targetUri $forward_scheme://$server:$port$request_uri;
 add_header       X-Served-By $host;
 proxy_set_header Host $host;
 proxy_set_header X-Forwarded-Scheme $scheme;
 proxy_set_header X-Forwarded-Proto  $scheme;
 proxy_set_header X-Forwarded-For    $remote_addr;
 proxy_set_header X-Real-IP          $remote_addr;
-proxy_pass       $upstream;
+proxy_pass       $targetUri;