启用 CORS 过滤与路由策略:static_resources: listeners: - name: listener_0 address: socket_address: { address: 0.0.0.0, port_value: 8080 } 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 stat_prefix: ingress_http route_config: name: local_route virtual_hosts: - name: backend domains: ["*"] routes: - match: { prefix: "/api" } typed_per_filter_config: envoy.filters.http.cors: "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.CorsPolicy allow_origin_string_match: - exact: "https://app.example.com" allow_methods: "GET,POST,OPTIONS" allow_headers: "content-type,authorization" expose_headers: "x-request-id" allow_credentials: true max_age: "86400" route: { cluster: app } http_filters: - name: envoy.filters.http.cors - name: envoy.filters.http.router clusters: - name: app type: LOGICAL_DNS connect_timeout: 1s lb_policy: ROUND_ROBIN load_assignment: cluster_name: app endpoints: - lb_endpoints: - endpoint: address: socket_address: { address: 127.0.0.1, port_value: 7001 }

发表评论 取消回复