Closed ambjlon closed 8 years ago
server { listen 8001; location ~ /abc/say$ { echo "world"; } location = /xyz/speak { echo_before_body "hello"; rewrite ^/xyz/speak$ /abc/say last; } }
curl "http://www.example.com/xyz/speak" gets the output: world Why is not the output like below: hello world
However, I found that the "proxy_pass" works well with echo_before_body.
Again, you need to understand the running phases of nginx directives. rewrite always runs before echo_before_body, no matter how they appear in the nginx.conf file. See my suggestions in #63.
rewrite
echo_before_body
nginx.conf
curl "http://www.example.com/xyz/speak" gets the output: world Why is not the output like below: hello world
However, I found that the "proxy_pass" works well with echo_before_body.