2

X-Accel を使用して、リクエストに関する情報を内部的にリダイレクトされた uri に渡そうとしています。

  location / {
      root /web/external;
      include fastcgi.conf;
      fastcgi_param SCRIPT_FILENAME $document_root/check.php;
      fastcgi_pass unix:/services/.sock/fastcgi.sock;
   }       
   location /internal/ {
      internal;
      alias /web/internal;
      include fastcgi.conf;
      fastcgi_param SCRIPT_FILENAME $document_root/app.php;
      fastcgi_pass unix:/services/.sock/fastcgi.sock;
   }

check.php は X-Accel-Redirect ヘッダーを /internal/$uri に返し、内部リクエストに渡したい他のヘッダー値も送信します。$sent_header_* を使用してヘッダーにアクセスしようとしましたが、うまくいかないようです。

4

1 に答える 1

1

私のユースケースにより近いと思われるサードパーティのモジュールを見つけました。私はそれが「組み込み」を見つけることができるものであることを望みますが

ngx_http_auth_request_module

http://mdounin.ru/hg/ngx_http_auth_request_module/file/tip/README http://mdounin.ru/hg/ngx_http_auth_request_module/file/tip/t/auth-request-set.t

構成は次のように変更されます。

location / {
    auth_request /check;
    auth_request_set $value $upstream_http_x_value;
    add_header X-Set-Value $value;
    root /web/internal;
    include fastcgi.conf;
    fastcgi_param SCRIPT_FILENAME $document_root/app.php;
    fastcgi_pass unix:/services/.sock/fastcgi.sock;
 }       
 location /check {
    internal;
    include fastcgi.conf;
    fastcgi_param SCRIPT_FILENAME $document_root/check.php;
    fastcgi_pass unix:/services/.sock/fastcgi.sock;
 }
于 2012-11-24T03:05:22.590 に答える