Skip to content

Commit b0504c6

Browse files
authored
docs: Add comprehensive CDN setup documentation (#529) (#601)
- Created new cdn_setup.md with detailed CDN configuration guide - Includes step-by-step setup instructions for general CDN and CloudFlare - Documents all three configuration methods (env var, yml config, Rails config) - Adds extensive troubleshooting section for common issues - Provides advanced configuration examples including CORS, SRI, and multiple CDNs - Updates deployment.md and README.md to reference the new guide - Makes CDN setup more discoverable for users looking for this functionality This addresses the documentation request in issue #529 where users needed guidance on setting up CDN (particularly CloudFlare) to serve JavaScript bundles from Shakapacker.
1 parent 34a1441 commit b0504c6

3 files changed

Lines changed: 402 additions & 2 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,19 @@ pnpm install --frozen-lockfile
10071007
bun install --frozen-lockfile
10081008
```
10091009
1010-
If you are using a CDN setup, Shakapacker does NOT use the `ASSET_HOST` environment variable to prefix URLs for assets during bundle compilation. You must use the `SHAKAPACKER_ASSET_HOST` environment variable instead (`WEBPACKER_ASSET_HOST` if you're using any version of Webpacker or Shakapacker before Shakapacker v7).
1010+
### CDN
1011+
1012+
Shakapacker supports serving JavaScript bundles and assets from a CDN. The key configuration is setting the `SHAKAPACKER_ASSET_HOST` environment variable (NOT the Rails `ASSET_HOST` variable).
1013+
1014+
For detailed CDN setup instructions, including CloudFlare configuration, troubleshooting, and advanced setups, see the [CDN Setup Guide](./docs/cdn_setup.md).
1015+
1016+
**Quick example:**
1017+
```bash
1018+
export SHAKAPACKER_ASSET_HOST=https://cdn.example.com
1019+
RAILS_ENV=production bundle exec rails assets:precompile
1020+
```
1021+
1022+
For more deployment documentation, see [Deployment](./docs/deployment.md).
10111023
10121024
## Example Apps
10131025
* [React on Rails Tutorial With SSR, HMR fast refresh, and TypeScript](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh)

0 commit comments

Comments
 (0)