asgard icon indicating copy to clipboard operation
asgard copied to clipboard

invalid region in URL doesn't produce 404 in REST API

Open aspyker opened this issue 10 years ago • 1 comments

curl -X GET http://asgard:8080/foobar/instance/list.json

Returns data from us-east-1. I would have expected a 404 status code. I believe RegionFilters is the cause. I'm guessing this is done to make the browser interface better, but it returns "incorrect" data to the REST interface. I like the fact that Asgard exposes all URL's to both browser and REST, but I wonder if there is a way to clean up the REST URL's a bit to be a bit more "correct".

aspyker avatar Aug 28 '13 20:08 aspyker

Yes, that's a bug. This relates to a backward compatibility feature for pre-multi-region scripts, where the region defaults to us-east-1 when not specified. The code in RegionFilters is being lazy about error handling when the region is passed explicitly in the URL. That's fixable.

Also note that some Asgard URLs are inherently global (non-regional) such as application and task URLs.

In the future, we plan to design a separate easy-to-use REST API, distinct from the current easy-to-write REST API, but we're not there yet.

Background At Netflix, before we thought about using other regions, we only used us-east-1, and people already had scripts pointing to Asgard region-less URLs, assuming us-east-1 as the region. The risk of removing that backward compatibility is now relatively low, but not zero.

joesondow avatar Aug 28 '13 21:08 joesondow