apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: example about how to enable Stream proxy is wrong

Open idbeta opened this issue 6 years ago • 1 comments

Issue description

example from here is wrong

apisix:
  stream_proxy:                 # TCP/UDP proxy
    tcp:                        # TCP proxy address list
      - 9100
      - 127.0.0.1:9101
    udp:                        # UDP proxy address list
      - 9200
      - 127.0.0.1:9211

should be

apisix:
  stream_proxy:                 # TCP/UDP proxy
    tcp:                        # TCP proxy port list
      - 9100
      - 9101
    udp:                        # UDP proxy port list
      - 9200
      - 9211

otherwise

nginx: [error] init_by_lua error: .../apisix//deps/share/lua/5.1/tinyyaml.lua:641: failed to classify line:         127.0.0.1:9101
stack traceback:
	[C]: in function 'error'
	.../apisix//deps/share/lua/5.1/tinyyaml.lua:641: in function 'parsemap'

Environment

  • apisix version (cmd: apisix version): master
  • OS:

idbeta avatar Nov 20 '20 15:11 idbeta

Hi, I think the doc had made a mistake on the YAML grammar.

127.0.0.1:9101's type is a string, so quotes should be used on this.

Like this:

apisix:
  stream_proxy:                 # TCP/UDP proxy
    tcp:                        # TCP proxy address list
      - 9100
      - "127.0.0.1:9101"
    udp:                        # UDP proxy address list
      - 9200
      - "127.0.0.1:9211"

starsz avatar Nov 21 '20 02:11 starsz