Hi,

I have a problem with certain modules when i use CDN, so i am trying to disable it in i.e. admin pages but there is no hooks in 8.x version.

I send you a quick patch to create a new one to allow modules disable CDN in custom conditions.

Best

CommentFileSizeAuthor
#2 hook_to_disable_cdn-2866693-2.patch1.11 KBdavid.gil
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

david.gil created an issue. See original summary.

david.gil’s picture

Here is the patch

david.gil’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: hook_to_disable_cdn-2866693-2.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Postponed (maintainer needs more info)

This is hugely problematic. This introduces mutable global state. A consequence of this is that because something was first computed for an admin route response, its file URLs would not point to the CDN. And then you end up getting support requests/bug reports about why this is happening.

In fact, I explicitly removed this from the D8 version: https://www.drupal.org/project/cdn/releases/8.x-3.0. The D7 version had this.

So unless you provide a *very* compelling reason, I will not add this. It's a maintenance nightmare.

So: *why* do you want this exactly?

david.gil’s picture

Hi Wim,

sorry for late response. I try to explain why i need this. We are using: https://www.drupal.org/project/focal_point that using JS it declare where is the focus of a image. Using it in production when we activated CDN the JS that positioned the "cross" stop working. As a quick solution i try to disable CDN only for admin pages so i post you this feature request.

Probably the problem is in focal-point, but i think that is not a bad idea that we can disable CDN in some use cases. Usually i think in admin pages and so on, i.e. with API calls and CORs problems it could be requisite to disable it.

However i will open a support request/bug in focal_point trying to solve the real problem.

Best
David

Wim Leers’s picture

Category: Feature request » Support request
Status: Postponed (maintainer needs more info) » Fixed

The problem is indeed either:

  1. in the Focal Point module
  2. or another case of #2811615: [upstream] [Core bug, fixed since 9.5] AJAX commands that need additional JS to be loaded will fail when JS is loaded from CDN. Is the focal point widget loaded via AJAX?

It's better to fix the root cause of a problem than adding a new feature that A) complicates the UI/UX/setup/maintainability/supportability, B) is just a work-around that you have to know about as an end user.

david.gil’s picture

Hi Wim,

as a followup, is a problem with 2, i am loading focalpoint as part of an ajax call. If i serve JS from main domain there is no problem.

Thx for the tip!.

David

Wim Leers’s picture

Title: Hook to disable CDN » Loading Focal Point module's JS as part of an AJAX call fails