MyOwnCDN
MyOwnCDN

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

  1. Create an account on MyOwnCDN and log in to your dashboard
  2. Click the "Add website" button
  3. Enter a site label and your website URL
  4. Save changes

Step 2: Setup a CDN provider

  1. Click on the newly created website in the dashboard
  2. On the side panel, click the "Select provider" button
  3. Choose a CDN provider and save the settings
  4. 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

  1. 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
  1. 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.