mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-08 16:49:02 +03:00
[GH-ISSUE #498] Suggestion: Remove underscores from CSS/JS file paths for better compatibility with Cloudflare CDN #281
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jiangtaste on GitHub (Dec 13, 2024).
Original GitHub issue: https://github.com/sigoden/dufs/issues/498
Hi there,
First of all, thank you for creating and maintaining DUFS—it’s an excellent tool!
I encountered an issue when serving DUFS through Cloudflare’s CDN. Specifically, CSS and JS file paths containing underscores (e.g., dufs_v0.43.0/index.css) are not handled correctly by Cloudflare. This leads to issues where the page cannot load styles or scripts, resulting in an improperly rendered UI.
The problem arises because underscores in URLs can cause compatibility issues in certain scenarios, as Cloudflare applies stricter rules for URL validation. This seems to be a known limitation of how some proxies or CDNs process URLs.
To address this, I would like to suggest:
1. Removing underscores (_) from the paths of CSS/JS files.
2. Replacing them with more universally compatible characters, such as dashes (-), for better compatibility with CDNs and proxies.
For example:
• dufs_v0.43.0/index.css → --dufs-v0.43.0--/index.css
This change would improve the usability of DUFS in scenarios where CDNs like Cloudflare are used.
Thank you for considering this suggestion! Please let me know if further clarification is needed.
Best regards,
Paul
@sigoden commented on GitHub (Dec 13, 2024):
@jiangtaste
Is there any official documentation from Cloudflare CDN that proves underscores are discouraged or forbidden?
If there are restrictions, then why is the link below valid?
https://cdnjs.cloudflare.com/ajax/libs/material-ui/4.12.4/esm/utils/unstable_useId.min.js
@jiangtaste commented on GitHub (Dec 13, 2024):
@sigoden
Thank you for your response.
I must admit that I haven’t been able to find any official documentation from Cloudflare explicitly discouraging or forbidding underscores in URLs. However, when I enabled Cloudflare’s CDN proxy for an Nginx reverse-proxied DUFS service, the page rendered blank. Interestingly, directly accessing dufs_v0.43.0/index.css worked perfectly fine, and disabling the CDN proxy resolved the issue entirely.
This behavior is puzzling, and I can only speculate that it might be related to the underscores in the URL paths. While it’s not definitive, this observation led me to suggest avoiding underscores in file paths to prevent potential compatibility issues with certain proxies or CDNs like Cloudflare.
Thank you again for looking into this!
@jiangtaste commented on GitHub (Dec 13, 2024):
Here is my Nginx configuration:
@jiangtaste commented on GitHub (Dec 13, 2024):
Hi there,
Please disregard my previous suggestion. After further investigation, I’ve identified the issue to be caused by Cloudflare’s newly introduced Rocket Loader. Disabling Rocket Loader under Speed > Optimization > Content Optimization > Rocket Loader resolved the issue, and everything is now working as expected.
I hope this helps anyone else encountering the same problem!