前提
openrestyにてリバースプロキシの構築を行っていますが、
ページを表示する際にページ内のリソース(画像,CSS,jsなど)の読み込み時になぜか404が返ってきます。
例:
index.html (OK)
├ style.css (OK)
├ test1.js (OK)
├ test2.js (404)
└ test3.js (OK)
※test2.jsが404だったりtest3.jsが404だったりとまちまちです。
尚、404が返ってくるリソースのURLに直接アクセスすると正しく取得できます。
実現したいこと
一度にファイルを読み込む際にも404出ずに正しく表示できるようにしたいです。
発生している問題・エラーメッセージ
debug指定によるエラーログですが、下記のように404が発生するリクエストと200になるリクエストでの差異はありませんでした。
2022/11/24 09:53:53 [error] 2172#2172: *192 [lua] ActiveProxy.lua:291: check(): [ActivePrody] get data[ホスト名], client: 192.168.x.x, server: , request: "GET / HTTP/1.1", host: "[ホスト名]" 2022/11/24 09:53:53 [error] 2172#2172: *192 [lua] ActiveProxy.lua:292: check(): nil, client: 192.168.x.x, server: , request: "GET / HTTP/1.1", host: "[ホスト名]" 2022/11/24 09:53:53 [error] 2172#2172: *193 [lua] ActiveProxy.lua:291: check(): [ActivePrody] get data[ホスト名], client: 192.168.x.x, server: , request: "GET /style.css HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/" 2022/11/24 09:53:53 [error] 2172#2172: *193 [lua] ActiveProxy.lua:292: check(): nil, client: 192.168.x.x, server: , request: "GET /style.css HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/" 2022/11/24 09:53:53 [error] 2172#2172: *199 [lua] ActiveProxy.lua:291: check(): [ActivePrody] get data[ホスト名], client: 192.168.x.x, server: , request: "GET /test1.js HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/" 2022/11/24 09:53:53 [error] 2172#2172: *199 [lua] ActiveProxy.lua:292: check(): nil, client: 192.168.x.x, server: , request: "GET /test1.js HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/" 2022/11/24 09:53:53 [error] 2172#2172: *204 [lua] ActiveProxy.lua:291: check(): [ActivePrody] get data[ホスト名], client: 192.168.x.x, server: , request: "GET /test2.js HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/" 2022/11/24 09:53:53 [error] 2172#2172: *204 [lua] ActiveProxy.lua:292: check(): nil, client: 192.168.x.x, server: , request: "GET /test2.js HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/" 2022/11/24 09:53:53 [error] 2172#2172: *207 [lua] ActiveProxy.lua:291: check(): [ActivePrody] get data[ホスト名], client: 192.168.x.x, server: , request: "GET /test3.js HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/" 2022/11/24 09:53:53 [error] 2172#2172: *207 [lua] ActiveProxy.lua:292: check(): nil, client: 192.168.x.x, server: , request: "GET /test3.js HTTP/1.1", host: "[ホスト名]", referrer: "http://[ホスト名]/"
尚、ActiveProxy.luaと言うのはリバースプロキシの処理を行っているluaのプログラムで、そこにログ出力のコードを書いてあるのでその情報がエラーログに出力されている為、不具合等ではありません。
該当のソースコード
nginx.conf
worker_processes 3; error_log logs/error.log info; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; lua_package_path "/usr/local/openresty/lualib/?.lua;;"; # restyディレクトリの指定 access_log logs/access.log main; error_log logs/example-error.log; rewrite_log on; sendfile on; #tcp_nopush on; keepalive_timeout 0; #keepalive_timeout 65; map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80 default; client_max_body_size 500M; proxy_buffering on; proxy_max_temp_file_size 8192m; proxy_buffers 128 32k; proxy_buffer_size 32k; proxy_busy_buffers_size 64k; #----------------------------------------------- # プロキシ設定 #----------------------------------------------- location / { proxy_max_temp_file_size 8192m; set $upstream ""; set $jump_prox_host ""; set $redirect "0"; set $redirect_ssl "0"; rewrite_by_lua_block { local actpxy = require "resty.ActiveProxy.ActiveProxy" local ap = actpxy:new() ap:init({ ~~~~~~~~~~~~~~~~~~ プロキシの設定情報(IPなど) ~~~~~~~~~~~~~~~~~~ }) local rephost = ap:check(ngx.var.host) } if ($redirect = "1") { # リダイレクト return 301 https://manage.server/; } proxy_request_buffering on; proxy_http_version 1.1; proxy_set_header Host $jump_prox_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_no_cache $do_not_cache; proxy_cache_bypass $do_not_cache; proxy_buffer_size 64k; if ($redirect = "0") { proxy_pass http://$upstream; } } } include /opt/nginx/conf/ssl.conf; }
試したこと
ワーカー数やスレッド数、キャッシュサイズ等の問題だと思い「worker_processes」や「worker_connections」、「proxy_buffer*」の設定変更等してみましたが特に発生する現象に変化はありませんでした。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/11/24 00:31
2022/11/24 00:43
2022/11/24 00:52