You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/01 02:22:59 UTC

[GitHub] [apisix] eastearth commented on issue #4942: bug: upstreaam response http code 302,then we found it was be redirected to an new port 9080

eastearth commented on issue #4942:
URL: https://github.com/apache/apisix/issues/4942#issuecomment-909814923


   > > 是否能通过配置configmap来指定X-Forwarded-Port呢,没有找到对应的配置,该在哪里配置呢,例如这个配置,应该设置哪一个参数呢?
   > > ```
   > > nginx_config:                     # config for render the template to genarate nginx.conf
   > >   error_log: "/dev/stderr"
   > >   error_log_level: "warn"         # warn,error
   > >   worker_rlimit_nofile: 20480     # the number of files a worker process can open, should be larger than worker_connections
   > >   event:
   > >     worker_connections: 10620
   > >   http:
   > >     access_log: "/dev/stdout"
   > >     keepalive_timeout: 60s         # timeout during which a keep-alive client connection will stay open on the server side.
   > >     client_header_timeout: 60s     # timeout for reading client request header, then 408 (Request Time-out) error is returned to the client
   > >     client_body_timeout: 60s       # timeout for reading client request body, then 408 (Request Time-out) error is returned to the client
   > >     send_timeout: 10s              # timeout for transmitting a response to the client.then the connection is closed
   > >     underscores_in_headers: "on"   # default enables the use of underscores in client request header fields
   > >     real_ip_header: "X-Forwarded-For"    # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
   > >     X-Forwarded-Port
   > >     real_ip_from:                  # http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
   > >       - 127.0.0.1
   > >       - 192.168.0.0/16
   > >       - 10.0.0.0/8
   > >       - 172.16.0.0/12
   > >       - 'unix:'
   > > ```
   > 
   > How did you install APISIX?
   > 
   > See https://github.com/apache/apisix/blob/master/apisix/cli/ngx_tpl.lua, currently, the related items are not configurable.
   
   actually,I install apisix by helm in k8s,
   now i configure apisix deployment like this,it is working now,
   _"        lifecycle:
             postStart:
               exec:
                 command:
                 - /bin/sh
                 - -c
                 - sed -i 's/proxy_set_header   X-Forwarded-Port     $var_x_forwarded_port/#proxy_set_header
    X-Forwarded-Port     $var_x_forwarded_port/g'
                   /usr/local/apisix/conf/nginx.conf
   "_
   
   but i think this still need a configurable item,
   because according to the introduction of k8s spec.containers.lifecycle.poststart,
   
   The operation performed by poststart does not necessarily complete before the main program entry enterpoint starts
   
   this is k8s official document introduction:
   "**Kubernetes sends the postStart event immediately after the Container is created. There is no guarantee, however, that the postStart handler is called before the Container's entrypoint is called. The postStart handler runs asynchronously relative to the Container's code, but Kubernetes' management of the container blocks until the postStart handler completes. The Container's status is not set to RUNNING until the postStart handler completes.**
   
   "


-- 
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