Comments (2)
please share the steps to reproduce.
from apisix.
please share the steps to reproduce.
apisix docker-compose.yml
version: "3"
services:
apisix:
image: apache/apisix:${APISIX_IMAGE_TAG:-3.2.0-debian}
restart: always
volumes:
- ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
depends_on:
- etcd
network_mode: host
etcd:
image: bitnami/etcd:3.4.15
restart: always
volumes:
- etcd_data:/bitnami/etcd
environment:
ETCD_ENABLE_V2: "true"
ALLOW_NONE_AUTHENTICATION: "yes"
ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379"
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
network_mode: host
prometheus:
image: prom/prometheus:v2.25.0
restart: always
volumes:
- ./prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.yml
network_mode: host
grafana:
image: grafana/grafana:7.3.7
restart: always
volumes:
- "./grafana_conf/provisioning:/etc/grafana/provisioning"
- "./grafana_conf/dashboards:/var/lib/grafana/dashboards"
- "./grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini"
network_mode: host
volumes:
etcd_data:
driver: local
apisix config
apisix:
node_listen: 9080 # APISIX listening port
enable_ipv6: false
enable_control: true
control:
ip: "0.0.0.0"
port: 9092
stream_proxy:
only: false
udp:
- 9997
- 9996
deployment:
admin:
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.
admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1
role: admin # admin: manage all configuration data
- name: "viewer"
key: 4054f7cf07e344346cd3f287985e76a2
role: viewer
etcd:
host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
- "http://127.0.0.1:2379" # multiple etcd address
prefix: "/apisix" # apisix configurations prefix
timeout: 30 # 30 seconds
plugin_attr:
prometheus:
export_addr:
ip: "0.0.0.0"
port: 9091
add stream
curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"upstream": {
"nodes": {
"192.168.1.80:9999": 1
},
"type": "roundrobin"
},
"server_port":9997
}'
openresty docker-compose
version: '3'
services:
nginx:
image: openresty/openresty:1.19.9.1-14-buster-fat
restart: always
network_mode: host
environment:
- TZ=Asia/Shanghai
volumes:
- ./conf:/usr/local/openresty/nginx/conf
- ./nginx/logs:/usr/local/openresty/nginx/logs
nginx conf
#user nobody;
#worker_processes 1;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# Enables or disables the use of underscores in client request header fields.
# When the use of underscores is disabled, request header fields whose names contain underscores are marked as invalid and become subject to the ignore_invalid_headers directive.
# underscores_in_headers off;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
# Log in JSON Format
# log_format nginxlog_json escape=json '{ "timestamp": "$time_iso8601", '
# '"remote_addr": "$remote_addr", '
# '"body_bytes_sent": $body_bytes_sent, '
# '"request_time": $request_time, '
# '"response_status": $status, '
# '"request": "$request", '
# '"request_method": "$request_method", '
# '"host": "$host",'
# '"upstream_addr": "$upstream_addr",'
# '"http_x_forwarded_for": "$http_x_forwarded_for",'
# '"http_referrer": "$http_referer", '
# '"http_user_agent": "$http_user_agent", '
# '"http_version": "$server_protocol", '
# '"nginx_access": true }';
# access_log /dev/stdout nginxlog_json;
# See Move default writable paths to a dedicated directory (#119)
# https://github.com/openresty/docker-openresty/issues/119
client_body_temp_path /var/run/openresty/nginx-client-body;
proxy_temp_path /var/run/openresty/nginx-proxy;
fastcgi_temp_path /var/run/openresty/nginx-fastcgi;
uwsgi_temp_path /var/run/openresty/nginx-uwsgi;
scgi_temp_path /var/run/openresty/nginx-scgi;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
# Don't reveal OpenResty version to clients.
# server_tokens off;
}
stream {
server {
listen 9998 udp;
proxy_pass 192.168.1.80:9999;
proxy_timeout 1s;
proxy_responses 1;
}
}
udp server go code
package main
import (
"fmt"
"net"
)
func main() {
socket, err := net.ListenUDP("udp4", &net.UDPAddr{
IP: net.IPv4(0, 0, 0, 0),
Port: 9999,
})
if err != nil {
fmt.Println("监听失败!", err)
}
defer socket.Close()
for {
// 读取数据
data := make([]byte, 4096)
read, remoteAddr, err := socket.ReadFromUDP(data)
if err != nil {
fmt.Println("读取数据失败!", err)
continue
}
fmt.Println(read, remoteAddr)
fmt.Printf("%s\n\n", data)
// 发送数据
senddata := []byte("hello client!")
_, err = socket.WriteToUDP(senddata, remoteAddr)
if err != nil {
fmt.Println("发送数据失败!", err)
return
}
}
}
from apisix.
Related Issues (20)
- bug: 插件 jwt-auth 的 function get_real_payload 存在 key 和 exp 被恶意修改的可能 HOT 15
- help request: log_rotate is not working HOT 2
- feat: enhance the cas-auth plugin to support JSON format responses HOT 2
- feat: uri_without_ticket function from cas-auth plugin need to generate uri based on container enviroment HOT 3
- help request: how to send mTLS requests in apisix from Lua plugin HOT 5
- bug: nginx-1.25.3 is Vulnerable, waiting for a new release of openresty HOT 2
- feat: Support to set the upstream host dynamically HOT 10
- proposal: allow proxy_next_upstream directive HOT 2
- help request: how to configure redirect URI in openid-connect HOT 9
- help request: where can we find resty.apisix.{x} module HOT 5
- help request: Questions Regarding the `least_conn` Load Balancer HOT 1
- help request: Based on the JAVA language, how do plug-ins make high availability HOT 8
- help request: regex_uri in proxy-rewrite is not redirecting to sub-path HOT 6
- docs: change the `workflow` plugin category from General to Traffic Management HOT 2
- help request: what is A6 module in apisix? HOT 5
- Request Header Fields Too Large. StatusCode: 431
- help request: wsl2 ubuntu20.04.6 LTS start proxy-rewrite 502 Bad Gateway HOT 1
- docs: proxy-rewrite plugin http://iresty.com/test/home.html 404 HOT 4
- help request: Is there a general way to detect if a plugin is enabled? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apisix.