init commit
This commit is contained in:
110
plugins/envoy.yaml
Normal file
110
plugins/envoy.yaml
Normal file
@@ -0,0 +1,110 @@
|
||||
# docker run --rm --network host -v $(pwd):/etc/envoy -w /etc/envoy -it envoyproxy/envoy-distroless:v1.24.0
|
||||
# curl -u 'admin:admin' -H 'Origin: http://lenovo.com' -i http://vcap.me:10000/ip
|
||||
|
||||
static_resources:
|
||||
listeners:
|
||||
- address:
|
||||
socket_address:
|
||||
address: 0.0.0.0
|
||||
port_value: 10000
|
||||
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
|
||||
stat_prefix: ingress_http
|
||||
strip_any_host_port: true
|
||||
route_config:
|
||||
name: local_route
|
||||
virtual_hosts:
|
||||
- name: vcap_me
|
||||
domains:
|
||||
- vcap.me
|
||||
routes:
|
||||
- match:
|
||||
path: /ip
|
||||
route:
|
||||
auto_host_rewrite: true
|
||||
cluster: httpbin
|
||||
metadata:
|
||||
filter_metadata:
|
||||
envoy.filters.http.lua:
|
||||
plugins:
|
||||
- name: user-code
|
||||
conf:
|
||||
access: |
|
||||
ctx.var.requst = {
|
||||
path = ctx.headers:get(":path")
|
||||
}
|
||||
- name: basic-auth
|
||||
conf:
|
||||
username: admin
|
||||
password: admin
|
||||
- name: redirect
|
||||
conf:
|
||||
ret_code: 301
|
||||
uri: /headers
|
||||
headers:
|
||||
x-earth-token: xxx
|
||||
x-earth-project: yyy
|
||||
- match:
|
||||
path: /body
|
||||
direct_response:
|
||||
status: 200
|
||||
body:
|
||||
inline_string: "Body\n"
|
||||
metadata:
|
||||
filter_metadata:
|
||||
envoy.filters.http.lua:
|
||||
plugins:
|
||||
- name: user-code
|
||||
conf:
|
||||
access: |
|
||||
ctx.var.path = ctx.headers:get(":path")
|
||||
ctx.var.method = ctx.headers:get(":method")
|
||||
ctx.log.info("hit access")
|
||||
body_filter: |
|
||||
for key, value in pairs(ctx.var) do
|
||||
ctx.log.info("var: ", key, " = ", value)
|
||||
end
|
||||
ctx.log.info("hit body_filter")
|
||||
- match:
|
||||
path: /auth
|
||||
direct_response:
|
||||
status: 200
|
||||
body:
|
||||
inline_string: "Autherd\n"
|
||||
metadata:
|
||||
filter_metadata:
|
||||
envoy.filters.http.lua:
|
||||
plugins:
|
||||
- name: basic-auth
|
||||
conf:
|
||||
htpasswd: | # htpasswd -bnBC 10 admin admin
|
||||
admin:$2y$10$7y/gRzOG6zhB5WOnGp8xw.wMF9c4Fw6ZkPwaALHlMNFG5IZy1W3Um
|
||||
http_filters:
|
||||
- name: envoy.filters.http.lua
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
|
||||
default_source_code:
|
||||
filename: /etc/envoy/entry.lua
|
||||
- name: envoy.filters.http.router
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
||||
access_log:
|
||||
- name: envoy.access_loggers.stdout
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
|
||||
clusters:
|
||||
- name: httpbin
|
||||
type: LOGICAL_DNS
|
||||
load_assignment:
|
||||
cluster_name: httpbin
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: httpbin.org
|
||||
port_value: 80
|
||||
Reference in New Issue
Block a user