Problem/Motivation

Redirect responses are currently not supported in Tome, but should be.

Proposed resolution

Create an API for handling redirects, that can be extended to generate an .htaccess file or Netlify _redirects file before falling back to an HTML redirect (with <meta http-equiv="refresh" content="0; url=..." />).

Remaining tasks

Write a patch.

User interface changes

None.

API changes

TBD.

Data model changes

None.

Release notes snippet

TBD.

Comments

samuel.mortenson created an issue. See original summary.

samuel.mortenson’s picture

StatusFileSize
new11.15 KB

Here's a start to this, should have time before beta 2 to add tests. Still need to add some kind of event API for reacting to responses.

samuel.mortenson’s picture

StatusFileSize
new12.68 KB
new6.39 KB

Test coverage added, need to add the API.

samuel.mortenson’s picture

Status: Active » Needs review
StatusFileSize
new16.03 KB
new4.15 KB

This event should be enough to generate a redirects file.

Status: Needs review » Needs work

The last submitted patch, 4: 3017423-4.patch, failed testing. View results

samuel.mortenson’s picture

Status: Needs work » Needs review
StatusFileSize
new15.82 KB
new659 bytes

Huh, didn't know this annotation was possible.

samuel.mortenson’s picture

This looks good, but I'm wondering if instead of a new event, we could just flag Tome requests in a way that typical Response subscribers could pick up on - No new API necessary.

samuel.mortenson’s picture

StatusFileSize
new14.44 KB
new3.1 KB

This feels way better.

samuel.mortenson’s picture

StatusFileSize
new13.42 KB
new1.02 KB
samuel.mortenson’s picture

StatusFileSize
new13.13 KB
new972 bytes

  • samuel.mortenson authored f1a4b16 on 8.x-1.x
    Issue #3017423 by samuel.mortenson: Create an API for handling redirects
    
samuel.mortenson’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dpi’s picture

If anyone is trawling through Tome code and is wondering how/where the redirect is added, it can be found in Symfony as a form of a fallback to Location headers in \Symfony\Component\HttpFoundation\RedirectResponse.