Page MenuHomePhabricator

We should follow redirections when fetching configuration files
Closed, ResolvedPublic

Description

Multiple domains and subdomains may be aliases of the same canonical domain. For example, www.example.com may be an alias of example.com.

In these cases, we do not want to define separate configurations for all aliases. Instead, we want to define configuration files for the canonical domain, and use wiki redirect statements to point aliases to these configurations.

Make sure Web2Cit follows these redirect statements, which is currently not the case as reported by @Kerry_Raymond.

Event Timeline

diegodlh triaged this task as Medium priority.Mar 26 2022, 8:52 PM
diegodlh created this task.

We may need to consider the following:

  • It may be the case that (maybe mistakenly) not all of the files have been redirected. For example, templates.json may have been redirected, whereas tests.json not.
  • The Web2Cit-Server's translation summary page includes a link at the top to the list of files under a single prefix. For example Web2Cit/data/uy/com/elobservador/www/.
  • If a config file has been redirected to its canonical-domain version, we want the JSON editor to open (and save to) this target file (not the redirecting file).

We may need to consider additional points, but so far we may solve this by:

  • Not change the domain name on the Domain object to its canonical. For example, if www.example.com was requested and one or more of its config files are redirected to the corresponding for example.com, do not change the Domain object's domain name to example.com.
  • But, DO change the path to the redirected file in the DomainConfiguration object.

Have the Web2Cit-Core RevisionsApi's fetchRevisions method return a page object (instead of just the revisions) including the page's title (which will be the redirection target in case of redirection). This would be used by DomainConfiguration's fetchRevisionIds method (which calls fetchRevisions first) to update the storage property accordingly.

Alternatively, update both the Web2Cit-Core and the Web2Cit-JSON-Editor to follow redirections.

First approach seems neater, but would require changing how the Web2Cit-Server's summary page links to the prefix where all configuration files for a domain can be found. In addition, it may cause (unexpected?) results, such as the JSON-response format showing the redirected path for the configuration files.

The second approach seems simpler to implement, but may cause trouble having to deal with the same problem in different parts of the ecosystem (e.g., the JSON editor, the to-be-implemented saving config files from Web2Cit-Core, etc).

diegodlh claimed this task.

Resolved using the second approach listed above, in w2c-core's 9d36262b and w2c-server's a8907361. Will be deployed with v1.1.

Note that this will impact Web2Cit-Monitor, which will list canonical and alias domains independently.