URL redirection

Issue #120 new
Alan Noble created an issue

This feature has two parts:

  1. An API to manage an association between a source URL and a forwarding URL.
  2. A method that performs the redirection by means of returning HTTP status code 302.

This is a prerequisite to Issue #118

Comments (4)

  1. Alan Noble reporter

    I propose the following Forwarding struct for representing the association between a source URL and its forwarding URL:

    type Forwarding struct {
    From string
    To string
    }

    A forward API method would update the association, i.e.., /api/forward/from/to

    Omitting the final ‘to’ argument would disable the forwarding.

  2. Alan Noble reporter

    Reflecting on this, we need edit access control and we might as well make the struct generic.

    type KeyValue struct {
    Key string
    Value string
    Meta string
    Owners []string
    }

    When used for URL forwarding:

    Key is the “from” URL,

    Value the “to” URL,

    Meta is optional metadata (which could be “redirect” in this case), and

    Owners is owner info, i.e., who is permitted to edit the struct.

  3. kortschak

    Are these intended to be map keys at any point? If so, you can't have the []string since slice types are not comparable.

  4. Alan Noble reporter

    No. I envisioned Owners would be a slice of email addresses or web domains granted write access to the struct.

  5. Log in to comment