You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "jujiale (via GitHub)" <gi...@apache.org> on 2023/03/29 06:49:34 UTC

[GitHub] [apisix] jujiale opened a new issue, #9191: help request: when use apisix or openresty proxy another openresty. ngx.say appears different phenomenon

jujiale opened a new issue, #9191:
URL: https://github.com/apache/apisix/issues/9191

   ### Description
   
   hello.
   I have three server(A is apisix. B is openresty . C is openresty)
   such as A ip = 127.0.0.1    B ip = 127.0.0.2   C ip = 127.0.0.3
   B -> nginx.conf
   `
       server {
           listen       80;
           server_name  localhost;
           add_header Access-Control-Allow-Origin *;
   
           location /test {
   
               proxy_pass http://127.0.0.3;
               proxy_set_header    X-Forwarded-Host    $host;
               proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
   
           }
   
       }
   
   `
   
   C -> nginx.conf:
   `
   
           server {
               listen 9001;
               location /test {
                   default_type text/html;
                   proxy_http_version  1.1;
                   content_by_lua '
                       ngx.say("Hello, World I am 127.0.0.3!")
                   ';
               }
           }
       
       
           upstream my_test1 {
           server 127.0.0.3:9001 weight=1 max_fails=2 fail_timeout=10s;
       }
       
               server {
               listen 80;
               proxy_buffering off;
               location /test {
                   default_type text/html;
                   proxy_http_version  1.1;
                   proxy_set_header   Host             $host;
                   proxy_set_header   X-Real-IP        $remote_addr;
                   proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
                   access_by_lua_file /opt/test.lua;
                   proxy_pass http://my_test1 ;
               }
           }
   
   `
   
   the /opt/test.lua is below
   `
   
       ngx.say("rrr")
   
   `
   
   A(apisix) -> route config is:
   `
   
                {
             "uri": "/*",
             "name": "test",
             "methods": [
               "GET",
               "POST",
               "PUT",
               "DELETE",
               "PATCH",
               "HEAD",
               "OPTIONS",
               "CONNECT",
               "TRACE"
             ],
             "upstream": {
               "nodes": [
                 {
                   "host": "172.0.0.3",
                   "port": 80,
                   "weight": 1
                 }
               ],
               "timeout": {
                 "connect": 6,
                 "send": 6,
                 "read": 6
               },
               "type": "roundrobin",
               "scheme": "http",
               "pass_host": "pass",
               "keepalive_pool": {
                 "idle_timeout": 60,
                 "requests": 1000,
                 "size": 320
               }
             },
             "status": 1
           }
   
   `
   
   when I use A proxy C. and send the request:
   **curl http://127.0.0.1/test    it returns "rrr"**
   
   when I use B proxy C. and send the request:
   **curl http://127.0.0.2/test    it returns "Hello, World I am 127.0.0.3!"**
   
   when I send request to C directly:
   **curl http://127.0.0.3/test    it returns "rrr"**
   
   
   what confused me is why use B proxy C. it returns is different with A proxy C. but when I remove ngx.say("rrr"),both A proxy C and B proxy C return the same.
   
   why is this? hope your rely. thanks.
   
   ### Environment
   
   - APISIX version (run `apisix version`): 2.12.0
   - Operating system (run `uname -a`): centos7 3.10.0-1160.36.2.el7.x86_64
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): openresty/1.21.4.1
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): 3.5.0
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] jujiale closed issue #9191: help request: when use apisix or openresty proxy another openresty. ngx.say appears different phenomenon

Posted by "jujiale (via GitHub)" <gi...@apache.org>.
jujiale closed issue #9191: help request: when use apisix or openresty proxy another openresty. ngx.say appears different phenomenon
URL: https://github.com/apache/apisix/issues/9191


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] jujiale commented on issue #9191: help request: when use apisix or openresty proxy another openresty. ngx.say appears different phenomenon

Posted by "jujiale (via GitHub)" <gi...@apache.org>.
jujiale commented on issue #9191:
URL: https://github.com/apache/apisix/issues/9191#issuecomment-1489570062

   solved in#https://github.com/openresty/openresty/issues/154, thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org