docker - 特使中的重定向
问题描述
我正在我的舞台环境中测试特使配置,在这里我需要重定向到自定义页面“/oops”,只要在调用 test.com 时发生任何 5xx 错误。它可以直接访问路径“ http://test1.com/oops ”。有人可以建议我的想法吗?
static_resources:
listeners:
- name: test-listener
address:
socket_address: { address: 0.0.0.0, port_value: 30000 }
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
access_log:
- name: envoy.file_access_log
config:
path: "/dev/stdout"
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["test1.com"]
routes:
- match: { prefix: "/" }
route: { cluster: test1_service }
- name: local_service2
domains: ["test2.com"]
routes:
- match: { prefix: "/" }
route: { cluster: google_service }
http_filters:
- name: envoy.router
clusters:
- name: test1_service
connect_timeout: 0.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
hosts: [{ socket_address: { address: 172.17.0.3, port_value: 80 }}]
- name: google_service
connect_timeout: 0.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
hosts: [{ socket_address: { address: google.com, port_value: 80 }}]
解决方案
您可以在 envoy 中使用HTTP 路由来完成此操作。另请参阅route.VirtualHost配置。
推荐阅读
- excel - 如何按功能选择单元格
- nuxt.js - vue 路由操作。(#)
- r - 在 R 中使用 hisgest 值的 colname 添加新列
- oracle-apex - Oracle APEX 使用页面项值显示自定义警报消息
- sql - 使用 R 将数据插入 Vertica 表 (SQL)?
- javascript - javascript数字对于模来说太大了
- oracle - Oracle APEX - 为 POPUP LOV 设置 Null 显示值
- sql - Postgres SELECT Where 子句有条件地应用存储过程中的参数,当它们不为空时
- javascript - 查找在字符串中添加和删除了哪些单词,包括重复项
- angular - 自定义验证在 Angular 中不起作用