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

bug: 2.1 version create route with cors will cause an error #863

Closed
idbeta opened this issue Nov 24, 2020 · 5 comments · Fixed by #906
Closed

bug: 2.1 version create route with cors will cause an error #863

idbeta opened this issue Nov 24, 2020 · 5 comments · Fixed by #906
Assignees
Labels
backend bug Something isn't working
Milestone

Comments

@idbeta
Copy link
Contributor

idbeta commented Nov 24, 2020

Bug report

Describe the bug

2.1 version create route with cors plugin and cors used the default setting {}, as below:

{"name":"test","uris":["/name"],"methods":["GET","HEAD","POST","PUT","DELETE","OPTIONS","PATCH"],"plugins":{"cors":{}},"vars":[],"upstream":{"type":"roundrobin","timeout":{"connect":6000,"send":6000,"read":6000},"nodes":[{"host":"127.0.0.1","port":7000,"weight":1}]}}

when request the route, will cause an error:

*104794 failed to run header_filter_by_lua*: /Users/idbeta/1106/apisix/apisix/plugins/cors.lua:89: bad argument #1 to 'str_find' (string expected, got nil)
stack traceback:
	[C]: in function 'str_find'
	/Users/idbeta/1106/apisix/apisix/plugins/cors.lua:89: in function 'create_obj_fun'
	/Users/idbeta/1106/apisix/apisix/core/lrucache.lua:92: in function 'plugin_ctx'
	/Users/idbeta/1106/apisix/apisix/plugins/cors.lua:168: in function 'phase_func'
	/Users/idbeta/1106/apisix/apisix/init.lua:159: in function 'run_plugin'
	/Users/idbeta/1106/apisix/apisix/init.lua:622: in function 'common_phase'
	/Users/idbeta/1106/apisix/apisix/init.lua:632: in function 'http_header_filter_phase'
	header_filter_by_lua:2: in main chunk while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /name HTTP/1.1", upstream: "http://127.0.0.1:7000/name", host: "127.0.0.1:9080"
@idbeta idbeta added the bug Something isn't working label Nov 24, 2020
@membphis membphis added this to the 2.1.1 milestone Nov 24, 2020
@nic-chen nic-chen self-assigned this Nov 30, 2020
@moonming
Copy link
Member

moonming commented Dec 1, 2020

why test case PR will fix bug?

@moonming moonming reopened this Dec 1, 2020
@membphis
Copy link
Member

membphis commented Dec 1, 2020

we can close this issue. @nic-chen please confirm again

image

@moonming
Copy link
Member

moonming commented Dec 1, 2020

Please add the fix PR of apisix

@nic-chen
Copy link
Member

nic-chen commented Dec 2, 2020

updated in the PR.

@nic-chen
Copy link
Member

nic-chen commented Dec 2, 2020

related issue in APISIX: apache/apisix#2834
fixed by PR in APISIX: apache/apisix#2856

@nic-chen nic-chen closed this as completed Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants