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

Updating URI of an existing route causes 404 error #1682

Closed
bisakhmondal opened this issue Mar 27, 2021 · 4 comments
Closed

Updating URI of an existing route causes 404 error #1682

bisakhmondal opened this issue Mar 27, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@bisakhmondal
Copy link
Member

bisakhmondal commented Mar 27, 2021

Issue description

If I update the uris of an already created route, necessary effects are getting taken for the old uris name, but for the new ones, it is causing a 404 nginx/openresty error.

Expected behavior

The update should either take place or not, if the manager-api is able to update it should display the upstream content, else the apisix should send an error. But in this case the error is shown from nginx.

How to Reproduce

  1. Running all the containers. ./setup.sh up
  2. make a put request to managerapi for URI hello & route id r1
    [PUT] http://localhost:9000/apisix/admin/routes/r1
{
 "name": "route1",
 "uri": "/hello",
 "methods": ["GET"],
  "upstream": {
	"type": "roundrobin",
	 "nodes": [{
		"host": "172.16.238.20",
		 "port": 1980,
		"weight": 1
		 }]
	 }
 }
  1. Now making an update request with uri newhello keeping the same upstream
    [PUT] http://localhost:9000/apisix/admin/routes/r1
{
 "name": "route1",
 "uri": "/newhello",
 "methods": ["GET"],
  "upstream": {
	"type": "roundrobin",
	 "nodes": [{
		"host": "172.16.238.20",
		 "port": 1980,
		"weight": 1
		 }]
	 }
 }

It disables the old route. but for the updated route it is throwing an Nginx error.

Screenshots

after making the first API call
image

After updating the uri
The old uri
image

The new URI
image

Environment

Running the tests using docker-compose services.

./api/test/docker/setup.sh up
  • OS (cmd: uname -a): Linux turing 5.8.0-44-generic 50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • apisix-dashboard version, if have: 2.4
  • Browser version, if have: Google Chrome Version 88.0.4324.182 (Official Build) (64-bit)

Additional context

@bisakhmondal bisakhmondal added the bug Something isn't working label Mar 27, 2021
@starsz
Copy link
Contributor

starsz commented Mar 27, 2021

The URI in route is /newhello , but the URI in the browser /hellonew.

Please check about it.

@bisakhmondal
Copy link
Member Author

The URI in route is /newhello , but the URI in the browser /hellonew.

Please check about it.

Sorry, my bad. I have mistakenly put yesterday's screenshots. It's updated now. Thank you.

@nic-chen
Copy link
Member

@bisakhmondal
what is the content in nginx.conf
and is there error log for this?

@bisakhmondal
Copy link
Member Author

Thanks, @nic-chen, @starsz for looking into this. Actually, the error has nothing to do with manager-api. Thanks to @Jaycean, only /hello, /hello_ and /hello1 routes are whitelisted on the upstream docker image that we are currently using for testing [ ref ]. So in the case of newhello it's a 404 from upstream itself.

The issue isn't relevant anymore to keep it open.

Thanks again, everyone. Closing.

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

No branches or pull requests

3 participants