Skip to content

Rendering legacy widgets preview via an iframe may lead to a 414 URI too long error #33540

Open
@adamziel

Description

Description

Legacy widgets are rendered using an <iframe /> with src set like this:

src={ addQueryArgs( 'widgets.php', {
'legacy-widget-preview': {
idBase,
instance,
},
} ) }

This works when there aren't many parameters or when the server tolerates very long query strings. Unfortunately, when one of these conditions isn't met, we may see an error 414 URI too long like on the screenshot below:

Zrzut ekranu 2021-07-19 o 12 32 37

This is easiest to reproduce with a long piece of text, but it also occurs with short inputs when certain plugins are installed. For example, the https://pl.wordpress.org/plugins/widget-visibility-time-scheduler/ adds a number of form fields to every legacy widget's form and triggers errors 414 in certain configurations.

Step-by-step reproduction instructions

  1. Install and activate the "Classic widgets" plugin
  2. Add a new text widget
  3. Paste a few paragraphs of lorem ipsum and save
  4. Deactivate the classic widgets plugin
  5. Go to widgets.php

Expected behaviour

A correctly rendered preview

Actual behaviour

Error 414 (if there isn't one, just add a few more paragraphs of text and try again)

Metadata

Assignees

No one assigned

    Labels

    Needs DevReady for, and needs developer efforts[Block] Legacy WidgetAffects the Legacy Widget Block - used for displaying Classic Widgets[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions