Enable Configurable CDN for Default Pode Static Pages #1522
+86
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces a new feature that allows users to configure the CDN source for serving default Pode static pages, such as Swagger UI. This improves reliability and performance by allowing users to choose from multiple CDN providers.
Why This Change?
Currently, Pode defaults to using
https://unpkg.com
for serving static assets. However, unpkg has proven to be unreliable due to the following reasons:unpkg.com
has experienced periods of unavailability, causing failures in serving assets.jsDelivr
,unpkg.com
lacks automatic fallback mechanisms.unpkg.com
, leading to accessibility issues.To address these concerns, this change introduces a configurable CDN option, allowing users to select a more stable and performant source.
Feature Details
A new
ContentDeliveryNetwork
setting is introduced underWeb.Static
inserver.psd1
. This setting allows users to specify which CDN should be used for serving default static assets.Supported CDNs
https://cdn.jsdelivr.net/npm
(default)https://unpkg.com
https://cdnjs.cloudflare.com/ajax/libs
(requires URL modifications)Example Configuration in
server.psd1
Users can specify their preferred CDN in their Pode configuration:
Implementation Notes
https://cdn.jsdelivr.net/npm
to provide better reliability.ContentDeliveryNetwork
key is missing, Pode will fall back to the default (jsDelivr
).Testing
Benefits of This Change
✔ Increased Reliability – Users can avoid any CDN that has downtime by switching to a more stable CDN.
✔ Flexibility – Users can choose the best CDN for their environment, avoiding corporate restrictions.
✔ Seamless Integration – Backward compatible with existing configurations.
Fix: #1523