{"id":7017,"date":"2019-01-17T22:29:01","date_gmt":"2019-01-17T21:29:01","guid":{"rendered":"https:\/\/pi3g.com\/?p=7017"},"modified":"2019-01-17T22:29:01","modified_gmt":"2019-01-17T21:29:01","slug":"route-redirect-with-envoy","status":"publish","type":"post","link":"https:\/\/pi3g.com\/de\/route-redirect-with-envoy\/","title":{"rendered":"Weiterleiten &amp; Umleiten mit envoy"},"content":{"rendered":"<p>An example envoy.yaml showing how to route &amp; redirect.<\/p>\n<p>There are different options, see here<\/p>\n<p><a href=\"https:\/\/www.envoyproxy.io\/docs\/envoy\/latest\/api-v2\/api\/v2\/route\/route.proto#route-redirectaction\">https:\/\/www.envoyproxy.io\/docs\/envoy\/latest\/api-v2\/api\/v2\/route\/route.proto#route-redirectaction<\/a><\/p>\n<p>This envoy.yaml routes \/taxgod and \/taxgod\/ (the second could probably be omitted because the first one should also match it, I think) to a new port and a different protocol. <\/p>\n<p>\/picockpit is simply redirected to \/<\/p>\n<p>and then finally \/ is routed to the target_picockpit backend<\/p>\n<p><pre>static_resources:\n  listeners:\n  - address:\n      socket_address:\n        address: 0.0.0.0\n        port_value: 80\n    filter_chains:\n    - filters:\n      - name: envoy.http_connection_manager\n        config:\n          codec_type: auto\n          stat_prefix: ingress_http\n          route_config:\n            virtual_hosts:\n            - name: backend\n              domains: [\"*\"]\n              routes:\n              - match: { prefix: \"\/\" }\n                redirect:\n                  path_redirect: \"\/\"\n                  https_redirect: true\n          http_filters:\n          - name: envoy.router\n            config: {}\n  - address:\n      socket_address:\n        address: 0.0.0.0\n        port_value: 443\n    filter_chains:\n    - tls_context:\n        common_tls_context:\n          tls_certificates:\n          - certificate_chain: { filename: \"\/etc\/example-com.crt\" }\n            private_key: { filename: \"\/etc\/example-com.key\" }\n          alpn_protocols: [ \"h2,http\/1.1\" ]\n      filters:\n      - name: envoy.http_connection_manager\n        config:\n          stat_prefix: ingress_https\n          route_config:\n            virtual_hosts:\n            - name: backend\n              domains: [\"*\"]\n              routes:\n              - match: { prefix: \"\/taxgod\" }\n                redirect: { port_redirect: 2080, path_redirect: \"\/\", scheme_redirect: \"http\"}\n              - match: { prefix: \"\/taxgod\" }\n                redirect: { port_redirect: 2080, path_redirect: \"\/\", scheme_redirect: \"http\"}\n              - match: { prefix: \"\/picockpit\/\" }\n                redirect: { path_redirect: \"\/\" }\n              - match: { prefix: \"\/picockpit\" }\n                redirect: { path_redirect: \"\/\" }\n              - match: { prefix: \"\/gagarin\" }\n                direct_response: { status: 200, body: { inline_string: \"Bringing redemption to my dark night. Beautiful surrender is where I wanna be.\" } }\n              - match: { prefix: \"\/\" }\n                route: { cluster: target_picockpit }\n          http_filters:\n          - name: envoy.router\n            config: {}\n  clusters:\n  - name: target_taxgod\n    connect_timeout: 0.25s\n    type: strict_dns\n    lb_policy: round_robin\n    hosts:\n    - socket_address:\n        address: taxgod\n        port_value: 3000\n  - name: target_picockpit\n    connect_timeout: 0.25s\n    type: strict_dns\n    lb_policy: round_robin\n    hosts:\n    - socket_address:\n        address: picockpit\n        port_value: 3000\nadmin:\n  access_log_path: \"\/tmp\/envoy.log\"\n  address:\n    socket_address:\n      address: 0.0.0.0\n      port_value: 9901\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ein Beispiel envoy.yaml, das zeigt, wie man routen und umleiten kann. Es gibt verschiedene Optionen, siehe hier https:\/\/www.envoyproxy.io\/docs\/envoy\/latest\/api-v2\/api\/v2\/route\/route.proto#route-redirectaction Diese envoy.yaml leitet \/taxgod und \/taxgod\/ (das zweite k\u00f6nnte wahrscheinlich weggelassen werden, weil das erste auch dazu passen sollte, denke ich) auf einen neuen Port und ein anderes Protokoll um. \/picockpit wird einfach auf \/ umgeleitet und dann schlie\u00dflich...<\/p>","protected":false},"author":830,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[402],"tags":[481,489,487,488],"class_list":["post-7017","post","type-post","status-publish","format-standard","hentry","category-development","tag-envoy","tag-envoy-yaml","tag-redirect","tag-route"],"_links":{"self":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/7017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/users\/830"}],"replies":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/comments?post=7017"}],"version-history":[{"count":1,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/7017\/revisions"}],"predecessor-version":[{"id":7018,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/7017\/revisions\/7018"}],"wp:attachment":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/media?parent=7017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/categories?post=7017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/tags?post=7017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}