I ve a Kubernetes group which isshop in AWS (EKS).
我试图保护客户IP。 为此,我尝试在网络负荷平衡器中采用有利的代理协议第2号,该平衡器在分组前坐,并配置了处于侵略状态的控制器来处理。
然而,每份请求中,有一米申请有坏的错误,没有任何额外信息。
这是我的Nginx ingress controller configMap
apiVersion: v1
data:
allow-snippet-annotations: "true"
compute-full-forwarded-for: "true"
enable-real-ip: "true"
server-snippet: "listen 8000;
if ( $server_port = 80 ) {
return 308 https://$host$request_uri;
}
"
ssl-redirect: "false"
use-forwarded-headers: "true"
use-proxy-protocol: "true"
在Nginx config中,哪些是这样
## start server
server {
server_name [REDACTED] ;
listen 80 proxy_protocol ;
listen 443 proxy_protocol ssl http2 ;
set $proxy_upstream_name "-";
ssl_certificate_by_lua_block {
certificate.call()
}
location / {
set $namespace "[REDACTED]";
set $ingress_name "[REDACTED]";
set $service_name "[REDACTED]";
set $service_port "[REDACTED]";
set $location_path "/";
set $global_rate_limit_exceeding n;
rewrite_by_lua_block {
lua_ingress.rewrite({
force_ssl_redirect = false,
ssl_redirect = false,
force_no_ssl_redirect = false,
preserve_trailing_slash = false,
use_port_in_redirects = false,
global_throttle = { namespace = "", limit = 0, window_size = 0, key = { }, ignored_cidrs = { } },
})
balancer.rewrite()
plugins.run()
}
header_filter_by_lua_block {
lua_ingress.header()
plugins.run()
}
body_filter_by_lua_block {
plugins.run()
}
log_by_lua_block {
balancer.log()
monitor.call()
plugins.run()
}
port_in_redirect off;
set $balancer_ewma_score -1;
set $proxy_upstream_name "[REDACTED]";
set $proxy_host $proxy_upstream_name;
set $pass_access_scheme $scheme;
set $pass_server_port $proxy_protocol_server_port;
set $best_http_host $http_host;
set $pass_port $pass_server_port;
set $proxy_alternative_upstream_name "";
client_max_body_size 20m;
proxy_set_header Host $best_http_host;
# Allow websocket connections
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Request-ID $req_id;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $full_x_forwarded_for;
proxy_set_header X-Forwarded-Host $best_http_host;
proxy_set_header X-Forwarded-Port $pass_port;
proxy_set_header X-Forwarded-Proto $pass_access_scheme;
proxy_set_header X-Forwarded-Scheme $pass_access_scheme;
proxy_set_header X-Scheme $pass_access_scheme;
# Pass the original X-Forwarded-For
proxy_set_header X-Original-Forwarded-For $http_x_forwarded_for;
proxy_set_header Proxy "";
proxy_connect_timeout 5s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
proxy_buffering off;
proxy_buffer_size 4k;
proxy_buffers 4 4k;
proxy_max_temp_file_size 1024m;
proxy_request_buffering on;
proxy_http_version 1.1;
proxy_cookie_domain off;
proxy_cookie_path off;
proxy_next_upstream error timeout;
proxy_next_upstream_timeout 0;
proxy_next_upstream_tries 3;
proxy_pass http://upstream_balancer;
proxy_redirect off;
}
# Custom code snippet configured in the configuration configmap
listen 8000;
if ( $server_port = 80 ) {
return 308 https://$host$request_uri;
}
}
## end server
在我的吉大港山区目标人群中,通过AWS Console,使Proxy 规程 v2成为可能,但当有人打过任何终点时,结果就是结果。
<html>
<head>
<title>400 Bad Request</title>
</head>
<body>
<center>
<h1>400 Bad Request</h1>
</center>
<hr>
<center>nginx</center>
</body>
</html>
任何帮助都是巨大的。
提前感谢。