Add passthrough query setting per redirect

Created on 21 November 2024, 2 months ago

Problem/Motivation

The redirect setting "Retain query string through redirect." works perfectly when enabled for the redirects to forward the query parameters to the destination. However, it has a minute issue. A new page cache entry is created for each set of query parameters. This is fine for sites with fewer number of redirects. However, if the number is huge, this could increase the cache size a lot.

Steps to reproduce

  • Truncate the cache_page database table.
  • Ensure that the "Retain query string through redirect." setting at /admin/config/search/redirect/settings
  • Create a new redirect from "foo" to "/bar"
  • As an anonymous user visit "/foo". You should redirected to "/bar" (ignore the 404 error if it occurs).
  • Check the cache_page table. You should see two entries - one for the redirect itself and the other for the redirected path.
  • Visit "/foo?query=baz". You should be redirected to "/bar?query=baz".
  • Check the cache_page table again. There should be two additional entries.

Proposed resolution

In addition to the global setting, there should be a setting "per redirect" to retain the query parameters. So, instead of the behavior being global, it would be great to have it on redirect add/edit form. Of course, we only show that option if the global option is disabled.

Remaining tasks

MR and review

User interface changes

A new option is added to the Redirect add/edit form.

API changes

NA

Data model changes

An extra column gets added due to the new field.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇮🇳India ajits India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024