Closed (fixed)
Project:
CDN
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Jun 2019 at 07:14 UTC
Updated:
13 Apr 2020 at 10:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersWhy is this necessary? For nearly 2000 sites this hasn't been a blocker to use it.
Comment #3
netsliverHi,
When I go for example on /block/add CKEditor does not work, I have a 403 (see attachment).
Even with the following configuration in the .htaccess
This configuration works perfectly for the public part.
I do not understand why, but the patch I made allows me to unlock the situation.
Comment #4
netsliverIn any case it would be wise to exclude the CDN in some cases.
Comment #5
wim leersCould you please export and share your
cdn.settingsconfiguration? 🙏Comment #6
netsliverYes
Comment #7
wim leersHm, those are CORS errors. So this appears to be related to but different from #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. See the screenshot and screencast there, you'll see the similarity.
Did you configure Drupal core's CORS support?
Comment #8
muldos commentedHi, I got the same kind of bug, I have cors activated.
With farfuture activated, ckeditor wasn't loading properly in node/edit/xxx pages.
When inspecting using the console, I got a 403.
To be sure it wasn't cors related, I asked the ckeditor files directly (ie : by pasting the link in my browser bar) => 403 (full themed page "you are not allowed").
I've end up enabling cdn + farfuture for all except js+css
Here is my cdn.settings
and my cors settings in services.yml
David
Comment #9
muldos commentedHi forgot to mention, that I've started to debug it, and the 403 was fired by CdnFarfutureController here :
The calculated token was different from the security token.
David
Comment #10
muldos commentedHi, I've set this issue to active, because I have provided more info.
Comment #11
wim leersAhhh … right. CKEditor 4 does some really weird stuff with automatic asset loading. It makes assumptions that prevents us from applying far future caching optimizations because those involve embedding information in the URL.
This patch should solve the problem — please test and report back!
Comment #12
wim leersA similar problem was reported at #2849041: CKEditor translation JS files cannot be loaded (403) when using Interface Translation + "Serve all files" + "Forever cacheable files", #2915417: 403 due to invalid security token has terrible DX (was: "CKEditor / X-Content-Type-Options") and #3033066: 403 error for font files in ckeditor style sheet, but I did not see this potential work-around back then.
This is even the reason I did #2827998: Add a new default option to the CDN UI: "all files except CSS+JS", and make this the new default of the CDN module, include upgrade path … which means that in the
8.x-4.xversion of the CDN module, it would become feasible to change the default back to "all files". Although the reasoning in #2827998 for not doing that still stands.P.S.: the work-around provided in the patch in #11 is ugly technically speaking, but it's the right thing to do: not every user should have to figure this out, not everybody should have to understand the weirdness of CKEditor 4's automatic asset loading.
Comment #13
wim leersFix coding standards violation.
Comment #14
gaurav_manerkar commentedHello,
CKEditor on admin pages breaks when CDN is enabled.
Also some of the drupal core ajax functionality doesn't work properly when CDN is enabled.
Keeping this points in mind, i have created a patch that will exclude JS and CSS using CDN on admin pages.
Comment #15
wim leers@gauravmanerkar Rather than posting a new patch, could you please test the patch in #13 and provide feedback? 😊Thanks! 🙏
Comment #16
das-peter commentedJust came across this issue.
Patch works for me.
When reviewing the changes some questions came to mind:
Shouldn't we avoid to use "use Drupal\editor\Entity\Editor" as it is a potentially optional component we don't have a dependency on?
Add check if editor module is enabled?
Comment #17
wim leers#16:
Thank you so much for testing, and confirming that the patch works for you! :) That means this can go to RTBC 🥳
At first I strongly agreed, I started to change the code, but then I realized that it's a non-issue, because:
hook_editor_js_settings_alter()😀What is a problem is this:
A site may use a different text editor than CKEditor, and this code would fail.
Comment #18
das-peter commentedNo, thank you for the module and the patch :D
I just wasn't entirely sure if
useon a missing namespace might causes trouble but it seems that it only matters when a class in that missing namespace would be accessed. So I totally agree, thanks to the module specific hook we're good.Agreed - and solution looks good :)
Let's get this in!
Comment #19
wim leers