2.9 KiB
For DreamHost hosting, the owner of feed.falsefinish.club can configure CORS headers using an .htaccess file in the root directory of the site (or in the specific directory serving the audio files).
Setting CORS Headers on DreamHost
Create or edit the .htaccess file in the web root (typically ~/falsefinish.club/feed/ or wherever the audio files are served from) and add:
# Enable CORS for echo-reality.com
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "https://echo-reality.com"
Header set Access-Control-Allow-Methods "GET, HEAD, OPTIONS"
Header set Access-Control-Expose-Headers "ETag, Last-Modified, Content-Length"
</IfModule>
# Handle preflight OPTIONS requests
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
</IfModule>
If targeting specific file types only (recommended)
To apply CORS headers only to audio files:
<IfModule mod_headers.c>
<FilesMatch "\.(mp3|mp4|wav|ogg|m4a)$">
Header set Access-Control-Allow-Origin "https://echo-reality.com"
Header set Access-Control-Allow-Methods "GET, HEAD, OPTIONS"
Header set Access-Control-Expose-Headers "ETag, Last-Modified, Content-Length"
</FilesMatch>
</IfModule>
For multiple origins (if needed during development)
If you need to allow both the production domain and a local development server:
<IfModule mod_headers.c>
SetEnvIf Origin "^https://(echo-reality\.com|localhost:3000)$" CORS_ORIGIN=$0
Header set Access-Control-Allow-Origin "%{CORS_ORIGIN}e" env=CORS_ORIGIN
Header set Access-Control-Allow-Methods "GET, HEAD, OPTIONS"
Header set Access-Control-Expose-Headers "ETag, Last-Modified, Content-Length"
</IfModule>
How to add the .htaccess file on DreamHost
-
Via SFTP/FTP: Connect to the server using an FTP client (like FileZilla) and upload/edit the
.htaccessfile in the appropriate directory -
Via DreamHost Panel File Manager: Log into the DreamHost panel → Manage Websites → Files → navigate to the directory and create/edit
.htaccess -
Via SSH (if enabled): SSH into the server and use a text editor like
nanoorvim
Important notes for DreamHost
- DreamHost's shared hosting uses Apache, so
.htaccessfiles work out of the box - The
mod_headersmodule is enabled by default on DreamHost - Make sure the
.htaccessfile has proper permissions (644) - Changes take effect immediately—no server restart needed
Testing the configuration
After adding the .htaccess file, the owner can verify it's working by checking the response headers:
curl -I -X OPTIONS -H "Origin: https://echo-reality.com" \
"https://feed.falsefinish.club/Echo%20Reality/PINK%20FLIGHT/MP3%20BOUNCE/01.%20PINK%20FLIGHT%20ATTENDANT.mp3"
The response should include the Access-Control-Allow-Origin: https://echo-reality.com header.