CPanel / LiteSpeed Security Headers: Referrer-Policy Fix - Youtube Error 153
Standardising Security Headers on cPanel/LiteSpeed Servers

Purpose
This document explains a common issue found on cPanel servers running LiteSpeed where the global security headers are configured in a way that can break embedded YouTube videos and create incorrect HTTP response headers.
It also explains why we recommend using:
Referrer-Policy: strict-origin-when-cross-origininstead of:
Referrer-Policy: no-referreras the default global setting for shared hosting servers.
Background
Some websites may show the following YouTube embed error:
Error 153
Video player configuration errorThis can happen when YouTube cannot receive a suitable referrer from the website where the video is embedded.
On one cPanel/LiteSpeed server, the following global Apache include configuration was found:
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
Header always edit Set-Cookie (.*) "$1;HttpOnly;Secure"
Header always set X-Frame-Options "sameorigin"
Header setifempty Referrer-Policy: same-origin
Header set X-XSS-Protection "1; mode=block"
Header set X-Permitted-Cross-Domain-Policies "none"
Header set Referrer-Policy "no-referrer"
Header set X-Content-Type-Options: nosniff
</IfModule>This created two main problems.
Problem 1: Incorrect Header Syntax
The following lines are not correctly written:
Header setifempty Referrer-Policy: same-origin
Header set X-Content-Type-Options: nosniffThe colon after the header name is wrong in this context.
As a result, the browser may receive an invalid or unexpected response header such as:
Setifempty: Referrer-Policy: same-originThis is not a valid security header and should not be present in the response.
The correct syntax should use the header name without a colon, and the value should be placed inside quotes, for example:
Header always set X-Content-Type-Options "nosniff"Problem 2: Referrer-Policy no-referrer Can Break Embeds
The following header is very strict:
Referrer-Policy: no-referrerIt prevents the browser from sending any referrer information to external services.
This is good for privacy, but it can cause compatibility issues with some third-party services, including embedded video players, payment gateways, SSO systems, analytics tools, and other integrations.
For YouTube embeds, this can contribute to:
Error 153 - Video player configuration errorRecommended Referrer Policy
For shared hosting servers, the recommended global default is:
Referrer-Policy: strict-origin-when-cross-originThis is a balanced option.
It works as follows:
- For same-origin requests, the full referrer URL may be sent.
- For HTTPS cross-origin requests, only the origin is sent, for example:
https://example.com- The full page path is not sent to external websites.
- Referrer information is not sent when moving from HTTPS to HTTP.
This gives a good balance between privacy, security, and compatibility.
For example, instead of sending this full URL to YouTube:
https://example.com/private/page?id=123the browser only sends:
https://example.comThis is usually enough for third-party services that need to know the website origin, without exposing the full page path.
Recommended Global Header Block
For cPanel/LiteSpeed shared hosting servers, this is a recommended balanced configuration:
<IfModule LiteSpeed>
CacheRoot /home/lscache/
</IfModule>
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000"
Header always edit Set-Cookie "(.*)" "$1; HttpOnly; Secure"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Permitted-Cross-Domain-Policies "none"
Header always set X-Content-Type-Options "nosniff"
</IfModule>Important Note About HSTS
The following HSTS value is strong:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preloadHowever, it should not normally be applied globally on a shared hosting server unless all domains and all subdomains are guaranteed to have valid HTTPS.
The options:
includeSubDomains
preloadcan cause problems if any subdomain does not support HTTPS correctly.
For a safer shared hosting default, use:
Strict-Transport-Security: max-age=31536000Use includeSubDomains and preload only for specific domains where this is fully verified.
How To Apply This From WHM
Follow these steps:
- Log in to WHM as root.
- Go to:
Service Configuration → Apache Configuration → Include Editor
- Open:
Pre Main Include
- Select:
All Versions
- or:
Apache 2.4
- Remove any old or incorrect lines such as:
Header setifempty Referrer-Policy: same-origin Header set Referrer-Policy "no-referrer" Header set X-Content-Type-Options: nosniff
- Add the recommended block:
<IfModule LiteSpeed> CacheRoot /home/lscache/ </IfModule> <IfModule mod_headers.c> Header always set Strict-Transport-Security "max-age=31536000" Header always edit Set-Cookie "(.*)" "$1; HttpOnly; Secure" Header always set X-Frame-Options "SAMEORIGIN" Header always set Referrer-Policy "strict-origin-when-cross-origin" Header always set X-XSS-Protection "1; mode=block" Header always set X-Permitted-Cross-Domain-Policies "none" Header always set X-Content-Type-Options "nosniff" </IfModule>
- Save the changes.
- Rebuild and restart Apache when WHM asks.
- Restart LiteSpeed from:
WHM → Plugins → LiteSpeed Web Server → Restart LiteSpeed
How To Apply This From SSH
If needed, the active file can usually be checked with:
grep -RniE "Referrer-Policy|SetIfEmpty|setifempty|no-referrer|same-origin|Strict-Transport-Security|X-Content-Type-Options" \
/etc/apache2 /usr/local/apache/conf /etc/httpd /usr/local/lsws/conf /var/cpanel/templates \
--exclude="*.log" --exclude="*.log.*" 2>/dev/nullCommon files are:
/etc/apache2/conf.d/includes/pre_main_global.conf
/usr/local/apache/conf/includes/pre_main_global.confAfter editing, run:
apachectl configtest
/usr/local/cpanel/scripts/rebuildhttpdconf
/usr/local/cpanel/scripts/restartsrv_httpd
systemctl restart lswsOnly continue with the restart if:
Syntax OKis returned by apachectl configtest.
How To Test
Use curl to check the response headers:
curl -k -sI 'https://example.com/?v=header-test' | grep -iE 'referrer|setifempty|strict-transport|x-content-type|x-frame|server'Expected good result:
server: LiteSpeed
strict-transport-security: max-age=31536000
x-frame-options: SAMEORIGIN
referrer-policy: strict-origin-when-cross-origin
x-content-type-options: nosniffThe following should not appear:
referrer-policy: no-referrer
setifempty: Referrer-Policy: same-originBrowser Testing
In Chrome:
- Open the website.
- Open Developer Tools.
- Go to the Network tab.
- Reload the page.
- Click the page request.
- Check Response Headers.
The response should include:
Referrer-Policy: strict-origin-when-cross-originIt should not include:
Referrer-Policy: no-referrer
Setifempty: Referrer-Policy: same-originIf the page shows:
304 Not Modifieduse a new query string to bypass cache, for example:
https://example.com/?v=header-test-2YouTube Embed Test
A simple test page can use this iframe format:
<iframe
width="800"
height="450"
src="https://www.youtube.com/embed/VIDEO_ID"
title="YouTube video player"
referrerpolicy="strict-origin-when-cross-origin"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen>
</iframe>Replace VIDEO_ID with the real YouTube video ID.
Do not test using a local file opened as:
file:///path/to/test.htmlA local file is not a real website origin and may not send the expected referrer. Use a real domain or a local web server instead.
Example local test:
cd ~/Downloads
python3 -m http.server 8080Then open:
http://localhost:8080/test.htmlFinal Recommendation
For MassarCloud shared hosting servers, apply this correction as a standard baseline:
Referrer-Policy: strict-origin-when-cross-origin
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000Avoid using Referrer-Policy: no-referrer as a global default because it may break third-party integrations.
Avoid using includeSubDomains; preload globally unless all domains and subdomains are verified to support HTTPS correctly.
Summary
The recommended change improves compatibility while keeping strong security headers.
The most important fixes are:
- Remove invalid header syntax.
- Remove
Referrer-Policy: no-referreras a global default. - Use
Referrer-Policy: strict-origin-when-cross-origin. - Keep
X-Content-Type-Options: nosniff. - Keep
X-Frame-Options: SAMEORIGIN. - Use HSTS carefully on shared hosting servers.