我正在尝试将 envoy 设置为转发代理。我正在使用此处发布的配置文件:https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/dynamic_forward_proxy_filter
我正在绕圈子,试图让这件事发挥作用。
当我使用curl命令时:
curl --proxy 0.0.0.0:10000 https://www.example.org:443
我收到 404 消息:“路由已解析,但最终路由列表与传入请求不匹配”
谁能告诉我我做错了什么才能让它发挥作用?
最好的,
我能够使用此配置使其工作:
admin:
address:
socket_address:
address: 0.0.0.0
port_value: 9902
layered_runtime:
layers:
- name: static-layer
static_layer:
envoy.reloadable_features.allow_multiple_dns_addresses: true
envoy.reloadable_features.conn_pool_new_stream_with_early_data_and_http3: true
envoy.reloadable_features.http1_use_balsa_parser: true
envoy.reloadable_features.http2_use_oghttp2: true
envoy.reloadable_features.http3_sends_early_data: true
envoy.reloadable_features.postpone_h3_client_connect_to_next_loop: true
envoy.resource_limits.listener.proxy.connection_limit: 1000
overload.global_downstream_max_connections: 1000
static_resources:
clusters:
- name: dynamic_forward_proxy_cluster
connect_timeout: 2s
dns_lookup_family: ALL
lb_policy: CLUSTER_PROVIDED
cluster_type:
name: envoy.clusters.dynamic_forward_proxy
typed_config:
'@type': type.googleapis.com/envoy.extensions.clusters.dynamic_forward_proxy.v3.ClusterConfig
allow_coalesced_connections: true
dns_cache_config:
name: dynamic_forward_proxy_cache_config
dns_lookup_family: ALL
listeners:
- name: dynamic_forward_proxy_upgrade
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
http_filters:
- name: envoy.filters.http.dynamic_forward_proxy
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.dynamic_forward_proxy.v3.FilterConfig
dns_cache_config:
name: dynamic_forward_proxy_cache_config
dns_lookup_family: ALL
- name: envoy.filters.http.router
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
http2_protocol_options:
allow_connect: true
http3_protocol_options:
allow_extended_connect: true
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains:
- '*'
routes:
- match:
prefix: /
route:
cluster: dynamic_forward_proxy_cluster
- match:
connect_matcher: {}
route:
cluster: dynamic_forward_proxy_cluster
upgrade_configs:
- upgrade_type: CONNECT
connect_config: {}
stat_prefix: dynamic_forward_proxy_upgrade
address:
socket_address:
address: 0.0.0.0
port_value: 9094
traffic_direction: OUTBOUND
使用此命令:
curl --verbose --proxy "localhost:9094" ifconfig.io
请记住,这不是理想的配置,因为它接受来自任何 IP 的连接。
我从这里得到了这个配置:https://github.com/envoyproxy/envoy/issues/24771#issuecomment-1379026917