I just got stuck being ping-ponged between checkout steps. We are using NeedsRedirectException to forward from an iframe payment gateway to the next checkout step. That step involves talking to a remote API which could throw NeedsRedirectException backwards.

These get cached and you end up in a redirect loop from hell.

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review

https://github.com/drupalcommerce/commerce/pull/585

-
 -    parent::__construct(new TrustedRedirectResponse($url, $status_code, $headers));
 +    
 +    $response = new TrustedRedirectResponse($url, $status_code, $headers);
 +    $cacheable_metadata = new CacheableMetadata();
 +    $cacheable_metadata->setCacheMaxAge(0);
 +    $response->addCacheableDependency($cacheable_metadata);
 +    parent::__construct($response);

  • bojanz committed 0018ea0 on 8.x-2.x authored by mglaman
    Issue #2838472 by mglaman: Do not allow NeedsRedirectException to be...
bojanz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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