apache / apisix-helm-chart

Apache APISIX Helm Chart
https://apisix.apache.org/
Apache License 2.0
232 stars 210 forks source link

nginx_config configuration_snippet not working #652

Open superb-sjlim opened 1 year ago

superb-sjlim commented 1 year ago

Hello,

I am trying to add some NGINX configuration using configmap but somehow the error is occurring right this,

2023/10/26 12:38:03 [emerg] 1#1: unknown directive "client_header_buffer_size:" in /usr/local/apisix/conf/nginx.conf:267
nginx: [emerg] unknown directive "client_header_buffer_size:" in /usr/local/apisix/conf/nginx.conf:267

What i added to under the nginx_conf..

nginx_config:    # config for render the template to genarate nginx.conf
      error_log: "/dev/stderr"
      error_log_level: "warn"    # warn,error
      worker_processes: "auto"
      enable_cpu_affinity: true
      worker_rlimit_nofile: 20480  # the number of files a worker process can open, should be larger than worker_connections
      event:
        worker_connections: 10620
      http_server_configuration_snippet: |
        client_header_buffer_size: 1k
      http:
        enable_access_log: true
        access_log: "/dev/stdout"
        access_log_format: '$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\"'
        access_log_format_escape: default
        keepalive_timeout: "60s"
        client_header_timeout: 70s     # 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: 60s              # timeout for transmitting a response to the client.then the connection is closed
        underscores_in_headers: "off"   # default enables the use of underscores in client request header fields
        client_header_buffer_size: 1k
        real_ip_header: "X-Real-IP"    # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
        real_ip_from:                  # http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
          - 127.0.0.1
          - 'unix:'#

I also tried to use the next snippets, main_configuration_snippet http_configuration_snippet http_end_configuration_snippet http_server_configuration_snippet http_admin_configuration_snippet but all snippet returned same error message.

Moreover, I even added it under the http section but it is not applied to the inside of nginx.conf file on K8s POD.

Could anyone can tell me what i am doing wrong?

Thank you in advance.

Revolyssup commented 1 year ago

Will you try this?

nginx_config:
  error_log: "/dev/stderr"
  error_log_level: "warn"
  worker_processes: "auto"
  enable_cpu_affinity: true
  worker_rlimit_nofile: 20480
  event:
    worker_connections: 10620
  http_server_configuration_snippet: |
    # Your server configuration snippet, if any
  http:
    enable_access_log: true
    access_log: "/dev/stdout"
    access_log_format: '$remote_addr - $remote_user [$time_local] $http_host "$request" $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" $upstream_addr $upstream_status $upstream_response_time "$upstream_scheme://$upstream_host$upstream_uri"'
    access_log_format_escape: default
    keepalive_timeout: "60s"
    client_header_timeout: 70s
    client_body_timeout: 60s
    send_timeout: 60s
    underscores_in_headers: "off"
    client_header_buffer_size: 1k  # Move this line here
    real_ip_header: "X-Real-IP"
    real_ip_from:
      - 127.0.0.1
      - 'unix:'

I don't think client_header_buffer_size is present in http_server_configuration_snippet context.