BattlefyBlogHistoryOpen menu
Close menuHistory

Don't break the Internet

Ronald ChenSeptember 19th 2022

At Battlefy we build esports experiences with game publishers and brands. Often this entails hosting a website of the engagement.

For each website, 3 common URL requirements are

  1. Context path scopes engagement
  2. Don't leak information
  3. Don't break the Internet

Context path scopes engagement

Context path is the first segment of an URL path. For example, given the URL https://battlefy.com/marketing-event-name/about, the context path is marketing-event-name. The context path is decided by the client and the entire engagement is scoped under it. For the rest of the path, we are in full control and design it for our needs.

Don't leak information

Our engagements often span multiple seasons, but the later seasons may not be public yet. For example, for the first release of a new engagement, if we choose a URL https://battlefy.com/marketing-event-name/season-01/about, that would leak information. The path segment season-01, implies the existence of up to season-99!

But how can we design stable URLs? If we fail to do so, we would break the Internet.

Don't break the Internet

Let's say we shipped the first season of an engagement with the URL https://battlefy.com/marketing-event-name/about. But when the second season is released, we need to archive the first season, but still make it available. There are many ways to go about this, but most of them break existing URLs. I.E. they break the Internet.

Idea no. 1, just change the context path

  • Move https://battlefy.com/marketing-event-name/... to https://battlefy.com/marketing-event-name-season-1/...
  • Deploy season 2 to https://battlefy.com/marketing-event-name/...

This violates 2 requirements. First, we are not in control of the context path, the client is. Second, other websites that linked to https://battlefy.com/marketing-event-name/... expecting season 1 would suddenly get season 2. We broke the Internet.

OK, what if we move season 1 into a subpath?

Idea no. 2, just subpath season 1

  • Move https://battlefy.com/marketing-event-name/... to https://battlefy.com/marketing-event-name/season-1/...
  • Deploy season 2 to https://battlefy.com/marketing-event-name/...

While we have avoided changing the context path, we still broke the Internet. The season 2 URL is the old season 1 URL. But this does get us closer the actual solution.

Solution no. 1, add season subpath, but retain old URLs with redirects

  • Move & redirect https://battlefy.com/marketing-event-name/... to https://battlefy.com/marketing-event-name/season-1/... (not a wildcard, but explicit for each URL)
  • Deploy season 2 to https://battlefy.com/marketing-event-name/season-2/...
  • Redirect https://battlefy.com/marketing-event-name/ to https://battlefy.com/marketing-event-name/season-2/ (not a wildcard)

Doesn't this violate the requirement of not leaking information? Doesn't this imply the existence of season 3? We are free to add a season subpath now that we have more than one season. The season subpath is used to distinguish existing seasons and no more.

But doesn't this still break the Internet? Other websites that linked https://battlefy.com/marketing-event-name/ would suddenly get redirected to season 2. This isn't typically consider a breakage as https://battlefy.com/marketing-event-name/ is the top level entry point. The top level content will always change and link to other information. What would be considered a breakage are deeply linked content. For example, we need to carefully redirect https://battlefy.com/marketing-event-name/tournament-abc/results to https://battlefy.com/marketing-event-name/season-1/tournament-abc/results.

Note a simple wildcard redirect https://battlefy.com/marketing-event-name/* should not be used to send all remaining URLs to either season 1 nor season 2. Using wildcard redirects would either send users to the wrong season or break the Internet for future seasons. We do not want to paint ourselves into a corner. Redirects should be explicit. We know the finite set of all our URLs.

Solution no. 2, don't change the URL

Season 1 and season 2 can be integrated into the same page with existing URLs. There would simply need to be a season selector on the page. This might make the pages more complicated, but sometimes is the best choice. An URI fragment can be used instead for deep linking, but be careful! URI fragments open a whole who can of worms when trying not to break the Internet. JavaScript would be required to perform client side URI fragment redirects as the URI fragment is not sent to the server!

Do you want to add to the Internet without breaking it? You're in luck, Battlefy is hiring.

2022

Powered by
BATTLEFY