इस कॉन्फ़िगरेशन के साथ:मैं किसी क्लॉज के अंदर proxy_set_header क्यों नहीं डाल सकता?
server {
listen 8080;
location/{
if ($http_cookie ~* "mycookie") {
proxy_set_header X-Request $request;
proxy_pass http://localhost:8081;
}
}
}
जब मैं nginx सेवा को फिर से लोड मैं इस त्रुटि है:
Reloading nginx configuration: nginx: [emerg] "proxy_set_header" directive is not allowed here in /etc/nginx/conf.d/check_cookie.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed
यह विन्यास ठीक काम करता है, लेकिन यह मैं क्या चाहते हैं नहीं करता है:
server {
listen 8080;
location/{
proxy_set_header X-Request $request;
if ($http_cookie ~* "mycookie") {
proxy_pass http://localhost:8081;
}
}
}
क्यों मैं proxy_set_header किसी भी खंड के अंदर निर्देश नहीं डाल सकता?
अग्रिम धन्यवाद!
कृपया क्रॉस-पोस्ट न करें। http://serverfault.com/questions/506972/nginx-why-i-cant-put-proxy-set-header-inside-an-if-clause – ceejayoz
मैंने इस बारे में चर्चा करने के लिए एक बातचीत खोली। हम वहां चर्चा जारी रख सकते हैं। http://chat.stackexchange.com/rooms/8745/nginx – Neuquino