Core concepts
Setup on Laravel
Laravel setup is quite simple. However, you need to be bundling your assets with Vite.
Step 1: Add your website
- Create an account on MyOwnCDN and log in to your dashboard
- Click the "Add website" button
- Enter a site label and your website URL
- Save changes
Step 2: Setup a CDN provider
- Click on the newly created website in the dashboard
- On the side panel, click the "Select provider" button
- Choose a CDN provider and save the settings
- Once the zone propagates (some providers may take up to 30 minutes), take note of the "CDN Domain" value — you will need it in the next step.
Step 3: Setup custom base URL on Laravel
- Using the CDN domain value from Step 2, specify the ASSET_URL environment variable in your application's .env file:
ASSET_URL=https://cdn.example.com
- After configuring the asset URL, all re-written URLs to your assets will be prefixed with the configured value:
https://cdn.example.com/build/assets/app.9dce8d17.js
Remember that absolute URLs are not re-written by Vite, so they will not be prefixed.
That's it! You're CDN is now setup and ready for use.