Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstream config, cann't select Host header for option 'Keep the same Host from client request' #2409

Closed
jinnyu opened this issue Apr 2, 2022 · 8 comments · Fixed by #2421
Assignees
Labels
bug Something isn't working

Comments

@jinnyu
Copy link

jinnyu commented Apr 2, 2022

Issue description

Config a upstream
Upstream type : node
Hostname : somehost.com
when submit form, apisix dashboard backend will return 500.

binary-apisix-dashboard-1  | err; interface conversion: interface {} is map[string]interface {}, not []*entity.Node
binary-apisix-dashboard-1  | [Recovery] 2022/04/02 - 08:54:13 panic recovered:
binary-apisix-dashboard-1  | 
binary-apisix-dashboard-1  | interface conversion: interface {} is map[string]interface {}, not []*entity.Node
binary-apisix-dashboard-1  | /usr/local/go/src/runtime/iface.go:261 (0x40a5d4)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/core/store/validate.go:169 (0xbe328d)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/core/store/validate.go:226 (0xbe34b2)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/core/store/validate.go:253 (0xbe3609)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/core/store/store.go:249 (0xbdfa4a)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/core/store/store.go:315 (0xbe0204)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/handler/upstream/upstream.go:202 (0xc93b61)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware.go:18 (0x84ffab)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/base.go:16 (0xbedef4)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/traffic_log.go:73 (0xbedef5)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/base.go:16 (0xbebf8d)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/http_input.go:77 (0xbebf8e)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/base.go:16 (0xbed962)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/http_resp_reshap.go:19 (0xbed956)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/base.go:16 (0xbeec4e)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/handler/handler.go:81 (0xbeec42)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/base.go:16 (0xbebb61)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/middleware/http_injector.go:28 (0xbebb62)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/[email protected]/pipe.go:84 (0x8502a1)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/shiningrush/droplet/wrapper/[email protected]/gin.go:41 (0xbefd7e)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xbe923d)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/filter/authentication.go:81 (0xbe8eaa)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xbe96ca)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/filter/recover.go:53 (0xbe96b4)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xbea510)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/filter/schema.go:240 (0xbea3ea)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xbe670d)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/filter/logging.go:35 (0xbe66f4)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xbe63f5)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/filter/ip_filter.go:107 (0xbe6346)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xbe9c76)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/filter/request_id.go:41 (0xbe9c5a)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xbe95f8)
binary-apisix-dashboard-1  | /usr/local/apisix-dashboard/api/internal/filter/cors.go:31 (0xbe95e4)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0xc9602c)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-contrib/[email protected]/handler.go:60 (0xc96002)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0x9c7f04)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:409 (0x9c7b39)
binary-apisix-dashboard-1  | /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:367 (0x9c7673)
binary-apisix-dashboard-1  | /usr/local/go/src/net/http/server.go:2879 (0x6fe77a)
binary-apisix-dashboard-1  | /usr/local/go/src/net/http/server.go:1930 (0x6f9e27)
binary-apisix-dashboard-1  | /usr/local/go/src/runtime/asm_amd64.s:1581 (0x464ae0)

Expected behavior

can be normal configed.

How to Reproduce

Config a upstream

Upstream type : node
Hostname : somehost.com

when submit form, apisix backend will return 500.

Screenshots

a6d

Environment

  • apisix version 2.12.1-centos, running in docker-compose from offical image
  • OS (cmd: uname -a): running in docker-compose from offical image
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V): running in docker-compose from offical image
  • etcd version, if have (cmd: run etcd --version): 3.4.18 (binary deylop)
  • apisix-dashboard version, if have: 2.11.0, running in docker-compose from offical image
  • Browser version, if have: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36

Additional context

docker-compose does nothing, only mount some files to container

No response

@jinnyu jinnyu added the bug Something isn't working label Apr 2, 2022
@jwrookie
Copy link
Contributor

jwrookie commented Apr 5, 2022

Sorry for not reproducing the problem by following your steps.
BTW, according to your error message, the cause of the panic is a type assert error, which is a coding problem, pr is welcome

@jwrookie
Copy link
Contributor

jwrookie commented Apr 5, 2022

Can you give me a curl request?

@jinnyu
Copy link
Author

jinnyu commented Apr 6, 2022

curl 'http://10.26.20.220:4010/apisix/admin/upstreams/401541446110282671' \
  -X 'PUT' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'Accept: application/json' \
  -H 'DNT: 1' \
  -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDkyMTE0NjIsImlhdCI6MTY0OTIwNzg2Miwic3ViIjoiYWRtaW4ifQ.KxtxoVGG6j-J-2lAVu-HVuKeSwv-yvVpokhd6YhSZq4' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Origin: http://10.26.20.220:4010' \
  -H 'Referer: http://10.26.20.220:4010/upstream/401541446110282671/edit' \
  -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7' \
  --data-raw '{"name":"xxx","type":"roundrobin","pass_host":"node","scheme":"https","timeout":{"connect":6,"send":6,"read":6},"keepalive_pool":{"size":320,"idle_timeout":60,"requests":1000},"nodes":{"somehost.com":1}}' \
  --compressed \
  --insecure

@jwrookie
Copy link
Contributor

jwrookie commented Apr 6, 2022

Your description may be wrong. When I select Use the domain or IP from Node list, I get this error

@jinnyu
Copy link
Author

jinnyu commented Apr 6, 2022

Your description may be wrong. When I select Use the domain or IP from Node list, I get this error

yeah, sorry for that...
So is this a bug?

@jwrookie
Copy link
Contributor

jwrookie commented Apr 7, 2022

yes, pr is welcome!

@jinnyu
Copy link
Author

jinnyu commented Apr 7, 2022

yes, pr is welcome!

I'm a java developer, and don't know how to code with go.
I will use the apisix api instead for now.
Waiting for next release.
Thanks for the amazeing work on apisix~

@jwrookie
Copy link
Contributor

jwrookie commented Apr 7, 2022

ok, I will make it done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants