Skip to content

Distinguish API routes and console routes #430

@david-crespo

Description

@david-crespo

Followup to #356 and #384

If we are going to serve console pages and the external API from the same server (Nexus), we need a way of distinguishing between the two sets of routes. More specifically, we need to be able to designate a catch-all route that matches all console URLs without matching any API routes.

In #384, we are able to cheat because all currently existing console routes start with /orgs, so we just use /orgs/* as the catchall route for console pages. This only works because a) there aren't any other console routes, and b) the API routes for orgs start with the full word /organizations. If we were to add console pages that don't start with /orgs OR shorten the API ones to /orgs (which we've discussed), we'd need another way of doing this.

A common approach is to put an /api prefix on all the API routes. This is the solution @zephraph and I lean toward, though to make it really clean we would want /* to match console routes, which would require Dropshot to allow overlapping route definitions (see oxidecomputer/dropshot#199).

On the other hand, we can avoid this problem entirely by serving console and nexus from different origins, but in order to do that we would have to solve #410.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions