NGINX模块用于编辑请求主体

flvtvl50  于 2024-01-06  发布在  Nginx
关注(0)|答案(1)|浏览(173)

我正在尝试创建一个NGINX模块,以将属性注入到请求体中(所有请求都是JSON格式的)发送到上游。这个想法是验证承载者身份验证令牌,从令牌中获取一个属性,并将其注入到后端使用的请求主体中。身份验证工作正常,我能够找到一种方法来操纵较小请求的主体(但我不知道我做的是否正确,如果我错了请纠正我).但是当请求很大时,代码不起作用,也锁定了请求.
以下是我到目前为止写的代码:

  1. static ngx_int_t ngx_http_user_auth_handler(ngx_http_request_t *r){
  2. // ...
  3. ngx_int_t rc;
  4. rc = ngx_http_read_client_request_body(r, ProcessBodyRequest);
  5. return rc;
  6. // ...
  7. }
  8. static void ProcessBodyRequest(ngx_http_request_t *r){
  9. ngx_log_error(NGX_LOG_DEBUG, r->connection->log, 0, "Test: starting body processing ");
  10. ngx_str_t randomstr = ngx_string("{\"foo\":\"bar\"}");
  11. u_char *new_body = ngx_pcalloc(r->pool,randomstr.len+1);
  12. ngx_memcpy(new_body,randomstr.data,randomstr.len);
  13. ngx_buf_t *b;
  14. b = ngx_create_temp_buf(r->pool,randomstr.len);
  15. b->last = (u_char*)ngx_cpymem(b->pos, randomstr.data, randomstr.len);
  16. r->request_body->bufs[0].buf = b;
  17. r->headers_in.content_length_n = randomstr.len;
  18. ngx_http_finalize_request(r, NGX_DONE);
  19. }

字符串
这是我的NGINX conf:

  1. location /api {
  2. proxy_pass http://dataserver;
  3. rewrite ^/api/(\w+)/([\w\/]+)?(\.*) /test-$1-api/$1/$2?$3 break;
  4. auth_jwt session; #off | jwks | session
  5. }


这里是日志:

  1. 2022/01/27 10:48:02 [debug] 9997#9997: notify eventfd: 17
  2. 2022/01/27 10:48:02 [debug] 9997#9997: testing the EPOLLRDHUP flag: success
  3. 2022/01/27 10:48:02 [debug] 9997#9997: malloc: 000056025842E4A0:6144
  4. 2022/01/27 10:48:02 [debug] 9997#9997: malloc: 0000560258475520:178176
  5. 2022/01/27 10:48:02 [debug] 9997#9997: malloc: 00005602584A0D30:73728
  6. 2022/01/27 10:48:02 [debug] 9997#9997: malloc: 00005602584B2D40:73728
  7. 2022/01/27 10:48:02 [debug] 9997#9997: epoll add event: fd:15 op:1 ev:00002001
  8. 2022/01/27 10:48:02 [debug] 9997#9997: setproctitle: "nginx: worker process"
  9. 2022/01/27 10:48:02 [debug] 9997#9997: worker cycle
  10. 2022/01/27 10:48:02 [debug] 9997#9997: epoll timer: -1
  11. 2022/01/27 10:48:05 [debug] 9995#9995: epoll: fd:8 ev:0001 d:0000560258475608
  12. 2022/01/27 10:48:05 [debug] 9995#9995: timer delta: 3230
  13. 2022/01/27 10:48:05 [debug] 9995#9995: worker cycle
  14. 2022/01/27 10:48:05 [debug] 9995#9995: epoll timer: 60000
  15. 2022/01/27 10:48:05 [debug] 9995#9995: epoll: fd:8 ev:0001 d:0000560258475608
  16. 2022/01/27 10:48:05 [debug] 9995#9995: timer delta: 0
  17. 2022/01/27 10:48:05 [debug] 9995#9995: worker cycle
  18. 2022/01/27 10:48:05 [debug] 9995#9995: epoll timer: 60000
  19. 2022/01/27 10:48:05 [debug] 9995#9995: epoll: fd:14 ev:2001 d:00005602584757D8
  20. 2022/01/27 10:48:05 [debug] 9995#9995: epoll: fd:15 ev:0001 d:00005602584758C0
  21. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http header: "Host: localhost"
  22. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http header: "Accept-Encoding: gzip, deflate, br"
  23. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http header: "Connection: keep-alive"
  24. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http header: "Content-Length: 23594"
  25. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http header: "Cookie: AUTH_SESSION_ID=8e46b1ef-2161-4a03-ae46-46c286787192.8e2f215841be; AUTH_SESSION_ID_LEGACY=8e46b1ef-2161-4a03-ae46-46c286787192.8e2f215841be; KEYCLOAK_IDENTITY=eyJhbGciOiJIUzI1NiIsIn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saXplZC1JRCIsInNlc3Npb25fc3RhdGUiOiI4ZTQ2YjFlZi0yMTYxLTRhMDMtYWU0Ni00NmMyODY3ODcxOTIiLCJzaWQiOiI4ZTQ2YjFlZi0yMTYxLTRhMDMtYWU0Ni00NmMyODY3ODcxOTIiLCJzdGF0ZV9jaGVja2VyIjoiRTV0QzNZRlRQYVNrWDRyMjdZZVNwcE1ld3BfT2E4UVdQZ1pwdno0cWg5byJ9.7LgYGRD7WF-TBk8A-CY9ymk-pVqEZtLa5NMhHPPc7No; KEYCLOAK_SESSION=Paragon/f:6294a860-354f-4362-ad11-7adee39366ec:[email protected]/8e46b1ef-2161-4a03-ae46-46c286787192; KEYCLOAK_SESSION_LEGACY=Paragon/f:6294a860-354f-4362-ad11-7adee39366ec:[email protected]/8e46b1ef-2161-4a03-ae46-46c286787192"
  26. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http header done
  27. 2022/01/27 10:48:05 [debug] 9995#9995: *2 event timer del: 15: 71532470
  28. 2022/01/27 10:48:05 [debug] 9995#9995: *2 generic phase: 0
  29. 2022/01/27 10:48:05 [debug] 9995#9995: *2 rewrite phase: 1
  30. 2022/01/27 10:48:05 [debug] 9995#9995: *2 test location: "/"
  31. 2022/01/27 10:48:05 [debug] 9995#9995: *2 test location: "50x.html"
  32. 2022/01/27 10:48:05 [debug] 9995#9995: *2 using configuration "/"
  33. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http cl:23594 max:1048576
  34. 2022/01/27 10:48:05 [debug] 9995#9995: *2 rewrite phase: 3
  35. 2022/01/27 10:48:05 [debug] 9995#9995: *2 post rewrite phase: 4
  36. 2022/01/27 10:48:05 [debug] 9995#9995: *2 generic phase: 5
  37. 2022/01/27 10:48:05 [debug] 9995#9995: *2 generic phase: 6
  38. 2022/01/27 10:48:05 [debug] 9995#9995: *2 generic phase: 7
  39. 2022/01/27 10:48:05 [debug] 9995#9995: *2 access phase: 8
  40. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http client request body preread 4806
  41. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http request body content length filter
  42. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http body new buf t:1 f:0 0000560258404F0A, pos 0000560258404F0A, size: 4806 file: 0, size: 0
  43. 2022/01/27 10:48:05 [debug] 9995#9995: *2 malloc: 00005602584C4D50:8192
  44. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http read client request body
  45. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: eof:0, avail:18788
  46. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: fd:15 8192 of 8192
  47. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: avail:10596
  48. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http client request body recv 8192
  49. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http body new buf t:1 f:0 00005602584C4D50, pos 00005602584C4D50, size: 8192 file: 0, size: 0
  50. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http write client request body, bufs 0000560258442910
  51. 2022/01/27 10:48:05 [debug] 9995#9995: *2 add cleanup: 0000560258442A10
  52. 2022/01/27 10:48:05 [debug] 9995#9995: *2 hashed path: /var/lib/nginx/body/0000000001
  53. 2022/01/27 10:48:05 [debug] 9995#9995: *2 temp fd:14
  54. 2022/01/27 10:48:05 [warn] 9995#9995: *2 a client request body is buffered to a temporary file /var/lib/nginx/body/0000000001, client: ::1, server: localhost, request: "POST /test HTTP/1.1", host: "localhost"
  55. 2022/01/27 10:48:05 [debug] 9995#9995: *2 writev: 14, 12998, 0
  56. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: eof:0, avail:10596
  57. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: fd:15 8192 of 8192
  58. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: avail:2404
  59. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http client request body recv 8192
  60. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http body new buf t:1 f:0 00005602584C4D50, pos 00005602584C4D50, size: 8192 file: 0, size: 0
  61. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http write client request body, bufs 00005602584429E0
  62. 2022/01/27 10:48:05 [debug] 9995#9995: *2 write: 14, 00005602584C4D50, 8192, 12998
  63. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: eof:0, avail:2404
  64. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: fd:15 2404 of 2404
  65. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: avail:0
  66. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http client request body recv 2404
  67. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http body new buf t:1 f:0 00005602584C4D50, pos 00005602584C4D50, size: 2404 file: 0, size: 0
  68. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http write client request body, bufs 00005602584429E0
  69. 2022/01/27 10:48:05 [debug] 9995#9995: *2 write: 14, 00005602584C4D50, 2404, 21190
  70. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http client request body rest 0
  71. 2022/01/27 10:48:05 [debug] 9995#9995: *2 Test: starting body processing
  72. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http finalize request: -4, "/test?" a:1, c:2
  73. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http request count:2 blk:0
  74. 2022/01/27 10:48:05 [debug] 9995#9995: *2 access phase: 9
  75. 2022/01/27 10:48:05 [debug] 9995#9995: *2 access phase: 10
  76. 2022/01/27 10:48:05 [debug] 9995#9995: *2 access phase: 11
  77. 2022/01/27 10:48:05 [debug] 9995#9995: *2 post access phase: 12
  78. 2022/01/27 10:48:05 [debug] 9995#9995: *2 generic phase: 13
  79. 2022/01/27 10:48:05 [debug] 9995#9995: *2 generic phase: 14
  80. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http init upstream, client timer: 0
  81. 2022/01/27 10:48:05 [debug] 9995#9995: *2 epoll add event: fd:15 op:3 ev:80002005
  82. 2022/01/27 10:48:05 [debug] 9995#9995: *2 posix_memalign: 00005602584061E0:4096 @16
  83. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script copy: "Host"
  84. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script var: "localhost"
  85. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script copy: "X-Forwarded-For"
  86. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script var: "::1"
  87. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script copy: "Connection"
  88. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script copy: "close"
  89. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script copy: "Content-Length"
  90. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script var: "13"
  91. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http script copy: ""
  92. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI5dHl2Qi1fWEdFZ1hMVkxkUFMxLUZ6Qks1TThPYTB0aE03ckt4RXE4cDNVIn0.eyJleHAiOjE2NDMxNzUyNTYsImlhdCI6MTY0MzE0MTM1MywiYXV0aF90aW1lIjoxNjQzMTM5MjU2LCJqdGkiOiI0ZmFhMWVhMy1jNWRjLTQyNDAtOTEyYy1lZDhiMzVmZTQ3ZTAiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjE4MDgwL2F1dGgvcmVhbG1zL1BhcmFnb24iLCJzdWIiOiJmOjYyOTRhODYwLTM1NGYtNDM2Mi1hZDExLTdhZGVlMzkzNjZlYzphZG1pbkBwYXJhZ29ubWVkcy5jb20iLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJ3ZWJzaXRlIiwibm9uY2UiOiI3ZWJjMzhkZi0xMzJlLTQzNGItOWQxYS1lZDFjNWQzYjA4YzIiLCJzZXNzaW9uX3N0YXRlIjoiYWNlYTVjZjctNmM5MC00YmZiLTgzZmQtMjcyNWQzZWMzMzAxIiwiYWNyIjoiMCIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwOi8vdnBuLnBhcmFnb25tZWRzIiwiaHR0cDovL2xvYy5wYXJhZ29ubWVkcyIsImh0dHA6Ly9sb2NhbGhvc3QiLCJodHRwOi8vbG9jYWxob3N0OjMwMDAiXSwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSIsInNpZCI6ImFjZWE1Y2Y3LTZjOTAtNGJmYi04M2ZkLTI3MjVkM2VjMzMwMSIsImFjY3ROdW0iOiIyNjAwMDEtMTIyMTY4MDMyNSIsIm5hbWUiOiJhZG1pbiIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluQHBhcmFnb25tZWRzLmNvbSIsImdpdmVuX25hbWUiOiJhZG1pbiIsImZhbWlseV9uYW1lIjoiIn0.ZdVGiQt_GneokfNvXREs0Q1pUGi3wPytlZV4o19hnrUb_X1S6QM6d-FeC7rkN7QSJk6VsD6GPs57mRZ2cKZSFg_Oefa3vZR2VzHDqIc3oJR3bbYxTEdxIycqbYJueUok1lolY2GVP7zvKfKD8b-0m4V4FVFUPaGEkzRt7ahmo2qpiicbDvlRIpdA0ZByrrVe-CFnpAzeaqUVjeclcuq39lulCY63YRkN-pNFlMAOsYplrdJ1vX91u-TZLZ8NaPe7lx4jVpT-rpaVHz5Quecg5OmgTVt9GK21KUgcKLUmNEAdQzmDii75oGKCix3cEqi-VI01_hTeitGDUMtEKOArjA"
  93. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "Content-Type: application/json"
  94. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "User-Agent: PostmanRuntime/7.29.0"
  95. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "Accept: */*"
  96. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "Postman-Token: 9d11dd75-1808-4038-830a-7a95b31e1944"
  97. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "Accept-Encoding: gzip, deflate, br"
  98. 2022/01/27 10:48:05 [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DovL2xvY2FsaG9zdDoxODA4MC9hdXRoL3JlYWxtcy9QYXJhZ29uIiwic3ViIjoiZjo2Mjk0YTg2MC0zNTRmLTQzNjItYWQxMS03YWRlZTM5MzY2ZWM6YWRtaW5AcGFyYWdvbm1lZHMuY29tIiwidHlwIjoiU2VyaWFsaXplZC1JRCIsInNlc3Npb25fc3RhdGUiOiI4ZTQ2YjFlZi0yMTYxLTRhMDMtYWU0Ni00NmMyODY3ODcxOTIiLCJzaWQiOiI4ZTQ2YjFlZi0yMTYxLTRhMDMtYWU0Ni00NmMyODY3ODcxOTIiLzdGF0ZV9jaGVja2VyIjoiRTV0QzNZRlRQYVNrWDRyMjdZZVNwcE1ld3BfT2E4UVdQZ1pwdno0cWg5byJ9.7LgYGRD7WF-TBk8A-CY9ymk-pVqEZtLa5NMhHPPc7No; KEYCLOAK_SESSION=Paragon/f:6294a860-354f-4362-ad11-7adee39366ec:[email protected]/8e46b1ef-2161-4a03-ae46-46c286787192; KEYCLOAK_SESSION_LEGACY=Paragon/f:6294a860-354f-4362-ad11-7adee39366ec:[email protected]/8e46b1ef-2161-4a03-ae46-46c286787192"
  99. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header:
  100. "POST /test HTTP/1.0
  101. Host: localhost
  102. X-Forwarded-For: ::1
  103. Connection: close
  104. Content-Length: 13
  105. Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI5dHl2Qi1fWEdFZ1hMVkxkUFMxLUZ6Qks1TThPYTB0aE03ckt4RXE4cDNVIn0.eyJleHAiOjE2NDMxNzUyNTYsImlhdCI6MTY0MzE0MTM1MywiYXV0aF90aW1lIjoxNjQzMTM5MjU2LCJqdGkiOiI0ZmFhMWVhMy1jNWRjLTQyNDAtOTEyYy1lZDhiMzVmZTQ3ZTAiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjE4MDgwL2F1dGgvcmVhbG1zL1BhcmFnb24iLCJzdWIiOiJmOjYy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108. Accept: */*
  109. Postman-Token: 9d11dd75-1808-4038-830a-7a95b31e1944
  110. Accept-Encoding: gzip, deflate, br
  111. Cookie: AUTH_SESSION_ID=8e46b1ef-2161-4a03-ae46-46c286787192.8e2f215841be; AUTH_SESSION_ID_LEGACY=8e46b1ef-2161-4a03-ae46-46c286787192.8e2f215841be; KEYCLOAK_IDENTITY=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI1ZGM1NmQ2ZS00NDQwLTQ4NmMtODU3Zi05ODI1NzVlYmEyMTYifQ.eyJleHAiOjE2NDE4Nzc0MTAsImlhdCI6MTY0MTg0MTQxMCwianRpIjoiMWIzYTQ4N
  112. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http cleanup add: 0000560258430978
  113. 2022/01/27 10:48:05 [debug] 9995#9995: *2 get rr peer, try: 1
  114. 2022/01/27 10:48:05 [debug] 9995#9995: *2 stream socket 16
  115. 2022/01/27 10:48:05 [debug] 9995#9995: *2 epoll add connection: fd:16 ev:80002005
  116. 2022/01/27 10:48:05 [debug] 9995#9995: *2 connect to 127.0.0.1:1080, fd:16 #3
  117. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream connect: -2
  118. 2022/01/27 10:48:05 [debug] 9995#9995: *2 posix_memalign: 00005602583DE6C0:128 @16
  119. 2022/01/27 10:48:05 [debug] 9995#9995: *2 event timer add: 16: 60000:71532490
  120. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http finalize request: -4, "/test?" a:1, c:2
  121. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http request count:2 blk:0
  122. 2022/01/27 10:48:05 [debug] 9995#9995: timer delta: 20
  123. 2022/01/27 10:48:05 [debug] 9995#9995: worker cycle
  124. 2022/01/27 10:48:05 [debug] 9995#9995: epoll timer: 60000
  125. 2022/01/27 10:48:05 [debug] 9995#9995: epoll: fd:15 ev:0004 d:00005602584758C0
  126. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http run request: "/test?"
  127. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream check client, write event:1, "/test"
  128. 2022/01/27 10:48:05 [debug] 9995#9995: epoll: fd:16 ev:0004 d:00005602584757D9
  129. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream request: "/test?"
  130. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream send request handler
  131. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream send request
  132. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream send request body
  133. 2022/01/27 10:48:05 [debug] 9995#9995: *2 chain writer buf fl:0 s:3421
  134. 2022/01/27 10:48:05 [debug] 9995#9995: *2 chain writer buf fl:1 s:13
  135. 2022/01/27 10:48:05 [debug] 9995#9995: *2 chain writer in: 00005602584309D8
  136. 2022/01/27 10:48:05 [debug] 9995#9995: *2 writev: 3434 of 3434
  137. 2022/01/27 10:48:05 [debug] 9995#9995: *2 chain writer out: 0000000000000000
  138. 2022/01/27 10:48:05 [debug] 9995#9995: *2 event timer del: 16: 71532490
  139. 2022/01/27 10:48:05 [debug] 9995#9995: *2 event timer add: 16: 60000:71532490
  140. 2022/01/27 10:48:05 [debug] 9995#9995: timer delta: 0
  141. 2022/01/27 10:48:05 [debug] 9995#9995: worker cycle
  142. 2022/01/27 10:48:05 [debug] 9995#9995: epoll timer: 60000
  143. 2022/01/27 10:48:05 [debug] 9995#9995: epoll: fd:16 ev:0005 d:00005602584757D9
  144. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream request: "/test?"
  145. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream process header
  146. 2022/01/27 10:48:05 [debug] 9995#9995: *2 malloc: 00005602584C6D60:4096
  147. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: eof:0, avail:-1
  148. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: fd:16 64 of 4096
  149. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy status 404 "404 Not Found"
  150. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "connection: close"
  151. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header: "content-length: 0"
  152. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy header done
  153. 2022/01/27 10:48:05 [debug] 9995#9995: *2 xslt filter header
  154. 2022/01/27 10:48:05 [debug] 9995#9995: *2 HTTP/1.1 404 Not Found
  155. Server: nginx/1.18.0 (Ubuntu)
  156. Date: Thu, 27 Jan 2022 13:48:05 GMT
  157. Content-Length: 0
  158. Connection: keep-alive
  159. 2022/01/27 10:48:05 [debug] 9995#9995: *2 write new buf t:1 f:0 0000560258406F60, pos 0000560258406F60, size: 137 file: 0, size: 0
  160. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http write filter: l:0 f:0 s:137
  161. 2022/01/27 10:48:05 [debug] 9995#9995: *2 file cleanup: fd:14
  162. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http cacheable: 0
  163. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http proxy filter init s:404 h:0 c:0 l:0
  164. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream process upstream
  165. 2022/01/27 10:48:05 [debug] 9995#9995: *2 pipe read upstream: 0
  166. 2022/01/27 10:48:05 [debug] 9995#9995: *2 pipe preread: 0
  167. 2022/01/27 10:48:05 [debug] 9995#9995: *2 pipe buf free s:0 t:1 f:0 00005602584C6D60, pos 00005602584C6DA0, size: 0 file: 0, size: 0
  168. 2022/01/27 10:48:05 [debug] 9995#9995: *2 pipe length: 0
  169. 2022/01/27 10:48:05 [debug] 9995#9995: *2 pipe write downstream: 1
  170. 2022/01/27 10:48:05 [debug] 9995#9995: *2 pipe write downstream done
  171. 2022/01/27 10:48:05 [debug] 9995#9995: *2 event timer: 16, old: 71532490, new: 71532530
  172. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream exit: 0000000000000000
  173. 2022/01/27 10:48:05 [debug] 9995#9995: *2 finalize http upstream request: 0
  174. 2022/01/27 10:48:05 [debug] 9995#9995: *2 finalize http proxy request
  175. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free rr peer 1 0
  176. 2022/01/27 10:48:05 [debug] 9995#9995: *2 close http upstream connection: 16
  177. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602583DE6C0, unused: 48
  178. 2022/01/27 10:48:05 [debug] 9995#9995: *2 event timer del: 16: 71532490
  179. 2022/01/27 10:48:05 [debug] 9995#9995: *2 reusable connection: 0
  180. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http upstream temp fd: -1
  181. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http output filter "/test?"
  182. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http copy filter: "/test?"
  183. 2022/01/27 10:48:05 [debug] 9995#9995: *2 posix_memalign: 00005602584C7D70:4096 @16
  184. 2022/01/27 10:48:05 [debug] 9995#9995: *2 image filter
  185. 2022/01/27 10:48:05 [debug] 9995#9995: *2 xslt filter body
  186. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http postpone filter "/test?" 00007FFFA5FCA050
  187. 2022/01/27 10:48:05 [debug] 9995#9995: *2 write old buf t:1 f:0 0000560258406F60, pos 0000560258406F60, size: 137 file: 0, size: 0
  188. 2022/01/27 10:48:05 [debug] 9995#9995: *2 write new buf t:0 f:0 0000000000000000, pos 0000000000000000, size: 0 file: 0, size: 0
  189. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http write filter: l:1 f:0 s:137
  190. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http write filter limit 0
  191. 2022/01/27 10:48:05 [debug] 9995#9995: *2 writev: 137 of 137
  192. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http write filter 0000000000000000
  193. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http copy filter: 0 "/test?"
  194. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http finalize request: 0, "/test?" a:1, c:1
  195. 2022/01/27 10:48:05 [debug] 9995#9995: *2 set http keepalive handler
  196. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http close request
  197. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http log handler
  198. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602584C6D60
  199. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602584C4D50
  200. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 0000560258441A70, unused: 0
  201. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 000056025842FCB0, unused: 48
  202. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602584061E0, unused: 120
  203. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602584C7D70, unused: 3799
  204. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602583E4540
  205. 2022/01/27 10:48:05 [debug] 9995#9995: *2 hc free: 0000000000000000
  206. 2022/01/27 10:48:05 [debug] 9995#9995: *2 hc busy: 00005602583FE490 1
  207. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602584041D0
  208. 2022/01/27 10:48:05 [debug] 9995#9995: *2 tcp_nodelay
  209. 2022/01/27 10:48:05 [debug] 9995#9995: *2 reusable connection: 1
  210. 2022/01/27 10:48:05 [debug] 9995#9995: *2 event timer add: 15: 65000:71537530
  211. 2022/01/27 10:48:05 [debug] 9995#9995: *2 post event 00005602584A0EB0
  212. 2022/01/27 10:48:05 [debug] 9995#9995: timer delta: 40
  213. 2022/01/27 10:48:05 [debug] 9995#9995: posted event 00005602584A0EB0
  214. 2022/01/27 10:48:05 [debug] 9995#9995: *2 delete posted event 00005602584A0EB0
  215. 2022/01/27 10:48:05 [debug] 9995#9995: *2 http keepalive handler
  216. 2022/01/27 10:48:05 [debug] 9995#9995: *2 malloc: 00005602583E4540:1024
  217. 2022/01/27 10:48:05 [debug] 9995#9995: *2 recv: eof:0, avail:0
  218. 2022/01/27 10:48:05 [debug] 9995#9995: *2 free: 00005602583E4540
  219. 2022/01/27 10:48:05 [debug] 9995#9995: worker cycle
  220. 2022/01/27 10:48:05 [debug] 9995#9995: epoll timer: 65000


你们能帮我把它修好吗?
谢谢你,谢谢

ngynwnxp

ngynwnxp1#

我编写了解决方案并将其上传到GitHub上,以帮助任何可能需要了解此事的人。还有一个文件包含一个Nginx conf文件,显示了如何使用它的示例。这个模块在我的用例中工作得很好。我希望它能有所帮助。
https://github.com/luizflaviolopes/nginx-keycloak-module
编码快乐!

相关问题