M3Server Technical Blog FAQ Allowing CORS headers with .htaccess

Allowing CORS headers with .htaccess



Some VR players are requiring that you allow access to CORS in hearders in order for videos to play.

Example of error:

Your video is not loading due to CORS headers on your website.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://vrwebsite.com/media/videos/vrclip.mp4. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).”

CORS can be allowed by inserting below code into .htaccess in root directory of website.

/home/user/vrwebsite.com/.htaccess

ALWAYS MAKE A LOCAL BACKUP OF FILE FIRST

Header set Access-Control-Allow-Origin "*"