Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request help: The configuration of the config.yaml file is a bit confusing. #1106

Closed
agile6v opened this issue Feb 4, 2020 · 3 comments · Fixed by #1113
Closed

request help: The configuration of the config.yaml file is a bit confusing. #1106

agile6v opened this issue Feb 4, 2020 · 3 comments · Fixed by #1113

Comments

@agile6v
Copy link
Member

agile6v commented Feb 4, 2020

Hi,

I want to add proxy_protocol flag in this file for http block and stream block seperately. But I'm not sure where to put it.

Flags look like below:
enable_http_proxy_protocol (for receive from client)
enable_tcp_proxy_protocol (for receive from client)
enable_tcp_proxy_protocol_to_upstream (for sending proxy_protocol to upstream)

Do you have any good suggestions?

Thanks.

@membphis @moonming

@agile6v
Copy link
Member Author

agile6v commented Feb 4, 2020

According to the current classification, real_ip_header and real_ip_from should be placed in nginx_config.http.

I would prefer to use the following way.

nginx_config:                     # config for render the template to genarate nginx.conf
  error_log: "logs/error.log"
  error_log_level: "warn"         # warn,error
  event:
    worker_connections: 10620
  http:
     real_ip_header: "X-Real-IP" 
     real_ip_from:              
        - 127.0.0.1
        - 'unix:'
    access_log: "logs/access.log"
    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
  stream:
    proxy_protocol:                          true
    proxy_protocol_to_upstream:  true
    tcp:                        
      - 9100
      - 9101
    udp:                        
      - 9200
      - 9211

@membphis
Copy link
Member

membphis commented Feb 5, 2020

According to the current classification, real_ip_header and real_ip_from should be placed in nginx_config.http.

your way is better ^_^

@moonming
Copy link
Member

moonming commented Feb 5, 2020

According to the current classification, real_ip_header and real_ip_from should be placed in nginx_config.http.

I would prefer to use the following way.

nginx_config:                     # config for render the template to genarate nginx.conf
  error_log: "logs/error.log"
  error_log_level: "warn"         # warn,error
  event:
    worker_connections: 10620
  http:
     real_ip_header: "X-Real-IP" 
     real_ip_from:              
        - 127.0.0.1
        - 'unix:'
    access_log: "logs/access.log"
    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
  stream:
    proxy_protocol:                          true
    proxy_protocol_to_upstream:  true
    tcp:                        
      - 9100
      - 9101
    udp:                        
      - 9200
      - 9211

I don't think so. nginx_config is a hacky way, Apache APISIX should hide these Nginx configurations finally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants