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

Allow handling redirects for default domain in the same way it's done with other domains #1163

Closed
5 tasks done
acelaya opened this issue Aug 24, 2021 · 0 comments · Fixed by #1255
Closed
5 tasks done
Labels
Milestone

Comments

@acelaya
Copy link
Member

acelaya commented Aug 24, 2021

Summary

Due to some limitations, setting redirects for default domain does not behave as expected afterwards.

You need to use config options or env vars instead (INVALID_SHORT_URL_REDIRECT_TO, BASE_URL_TO, REGULAR_404_REDIRECT_TO).

We should deprecate that config, create new one with the DEFAULT_ prefix (and probably without the _TO suffix) that acts as fallback for any domain without a specific value, and then make sure the default domain can also have it's own redirects handled as for any other domain.

  • INVALID_SHORT_URL_REDIRECT_TO -> DEFAULT_INVALID_SHORT_URL_REDIRECT
  • REGULAR_404_REDIRECT_TO -> DEFAULT_REGULAR_404_REDIRECT
  • BASE_URL_REDIRECT_TO -> DEFAULT_BASE_URL_REDIRECT

Additionally, the GET /domains endpoint should return a new prop with the default redirects, so that API consumers can know which is going to be the fallback behavior.

Currently, this can be inferred by checking the redirects of the default domain.

{
  "domains": {
    "data": [
      {
        "domain": "string",
        "isDefault": true,
        "redirects": {
          "baseUrlRedirect": "string",
          "regular404Redirect": "string",
          "invalidShortUrlRedirect": "string"
        }
      }
    ],
    "defaultRedirects": {
      "baseUrlRedirect": "string",
      "regular404Redirect": "string",
      "invalidShortUrlRedirect": "string"
    }
  }
}

  • Allow setting redirects for default domain.
  • "Unset" default domain when creating short URLs from the command line (for the API, a middleware is doing it already).
  • Set new env vars and deprecate current ones.
  • Update list domains endpoint with default redirects.
  • Refactor DomainRepository::findDomainsWithout to DomainRepository::findDomains, as it no longer uses the first argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant