Modal doesn't close after saving/updating, stuck on redirect

Created on 17 March 2024, 9 months ago

Problem/Motivation

The iframe modal doesn't close after saving/updating, it gets stuck on redirect page (with loading icon). Looks at the other issue which I though would help with multilingual sites, but our website was not multilingual so that issue patch didn't help.

Steps to reproduce

In Configuration > Development > Performance, enable Aggregate JavaScript files option and save (may need clear cache).
Go to any page edit with layout builder, add/edit block to open in iframe modal.
Save/Update the content and the iframe modal gets stuck in redirect page with loading icon.

Proposed resolution

Upon some investigation and debugging, it seems that excluding the aggregation of redirect.js script helped our issue.
So, disabled the aggregation (preprocess: false) on the redirect library yml file to solve our issue.

Remaining tasks

Created a small patch which might help others and needs testing.

πŸ› Bug report
Status

Needs review

Version

1.3

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia jigenshrestha

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

Comments & Activities

  • Issue created by @jigenshrestha
  • πŸ‡ΊπŸ‡ΈUnited States lpeabody

    I get an error that looks like this in my console:

    Mixed Content: The page at 'https://drupal-site.traefik.site/node/23/layout' was loaded over HTTPS, but requested an insecure form action 'http://drupal-site.traefik.site/layout_builder_iframe_modal/redirect'. This request has been blocked; the content must be served over HTTPS.
    

    Looks like it shouldn't be setting an absolute URL, or else risk protocol mismatch when folks are behind a reverse proxy that routes to http? Use a relative URL for the form action is perhaps a resolution?

  • πŸ‡¦πŸ‡ΉAustria InlΓ©

    Same issue as @Ipeabody. Works like a charm on local, but on the actual server, we get a Mixed Content warning similar to #3 about the content needing to be served over https.

    Given the OP had his issue fixed by changing the aggregation, should we open a new issue?

  • πŸ‡ΊπŸ‡ΈUnited States dago.aceves

    Howdy. If it works on local but not on remote servers, chances are you are running a reverse proxy on your remote and your Drupal is missing some additional configuration to make it happy.

    Seems similar to this
    https://www.drupal.org/project/layout_builder_iframe_modal/issues/3206990 β†’

  • πŸ‡ΊπŸ‡ΈUnited States lpeabody

    @dago.aceves is correct. My local site was behind a Traefik reverse proxy. For my local site configuration I just had to set this to fix the issue:

    $settings['reverse_proxy'] = TRUE;
      // Reverse proxy is handled by Docker Traefik container. Set the expected
      // addresses.
      $settings['reverse_proxy_addresses'] = [$_SERVER['REMOTE_ADDR']];
      $settings['reverse_proxy_trusted_headers'] = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_FORWARDED;
    

    This is fine for a local setup.

  • πŸ‡§πŸ‡ͺBelgium svendecabooter Gent
Production build 0.71.5 2024