ソースを参照

fix request id

lushuncheng 6 年 前
コミット
703f593f4b
3 ファイル変更10 行追加2 行削除
  1. 4 0
      config/nginx/conf.d/git.conf
  2. 4 0
      config/nginx/conf.d/yapi.conf
  3. 2 2
      config/nginx/nginx.conf

+ 4 - 0
config/nginx/conf.d/git.conf

@@ -8,6 +8,10 @@ server {
     location = /robots.txt {
         alias /code/web/norobots.txt;
     }
+    set $temp_request_id $http_x_request_id;
+    if ($temp_request_id = "") {
+        set $temp_request_id $request_id;
+    }
     location / {
         proxy_pass http://git/;
         proxy_set_header Host $http_host;

+ 4 - 0
config/nginx/conf.d/yapi.conf

@@ -1,6 +1,10 @@
 server {
     listen 80;
     server_name apidoc.proginn.com;
+    set $temp_request_id $http_x_request_id;
+    if ($temp_request_id = "") {
+        set $temp_request_id $request_id;
+    }
     location / {
         limit_req zone=byip burst=10;
         proxy_pass http://10.200.200.202:3000/;

+ 2 - 2
config/nginx/nginx.conf

@@ -66,8 +66,7 @@ http {
 
     # deny black ip
     deny 58.22.18.222;
-    
-    set $temp_request_id $request_id;
+
     log_format proginn-logid ' [$time_local] $host $remote_addr $remote_user $request $request_time $request_length $body_bytes_sent $status '
                         '$server_addr $upstream_addr $upstream_response_time $upstream_status $http_referer" "$http_user_agent" "$http_x_real_ip" "$http_x_forwarded_for" logId=$temp_request_id';
     access_log off;
@@ -78,6 +77,7 @@ http {
     server {
         listen      80 default_server;
         server_name _;
+        set $temp_request_id $request_id;
         return      444;
     }