Documentation

Visit Our xCloud Knowledge Base

Here is your one-stop source for in-depth articles, FAQs, and tutorials for you to excel at hosting & managing your websites.


How To Add Custom Security Headers in xCloud

Security headers are essential for protecting your websites from common web vulnerabilities by controlling how browsers behave. This guide will walk you through the correct way to add custom security headers in xCloud, covering both OpenLiteSpeed (OLS) and NGINX web servers.

In xCloud, directly editing the main server configuration files (like vhconf.conf) is not recommended, as these files are managed by the control panel and can be overwritten automatically when changes are made via the UI.

Add Custom Security Headers on OLS Servers in xCloud #

Step 1: SSH Into Your Server #

Before making any changes, you must SSH into your OLS server:

Step 2: Use the vhconf.server.conf Config File  #

Use the following file to define your custom HTTP security headers:

/usr/local/lsws/conf/vhosts/tstr.io/vhconf.server.conf

This file is not overwritten by the xCloud panel and is ideal for persisting manual changes such as custom headers.

Step 3: Add Security Headers #

To add custom security headers, update vhconf.server.conf with the following block:

  context / {
extraHeaders <<<END_extraHeaders
set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
set Referrer-Policy "strict-origin-when-cross-origin";
set Content-Security-Policy "upgrade-insecure-requests";
set Permissions-Policy "accelerometer=(), autoplay=(self https://www.youtube.com https://www.google.com https://www.facebook.com https://www.instagram.com https://platform.twitter.com https://player.vimeo.com https://www.linkedin.com https://js.hsforms.net), camera=self, cross-origin-isolated=(), display-capture=self, encrypted-media=(self https://www.youtube.com https://www.facebook.com https://www.instagram.com https://player.vimeo.com), fullscreen=(self https://www.youtube.com https://www.vimeo.com https://player.vimeo.com https://www.instagram.com https://www.facebook.com https://platform.twitter.com https://www.linkedin.com), geolocation=(self https://www.google.com), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=self, midi=(), payment=(self https://connect.stripe.com https://checkout.paypal.com https://js.squareup.com), picture-in-picture=(self https://www.youtube.com https://www.vimeo.com https://player.vimeo.com https://www.instagram.com https://www.facebook.com), publickey-credentials-get=self, screen-wake-lock=(), usb=(), web-share=(self https://www.youtube.com https://www.facebook.com https://www.instagram.com https://platform.twitter.com https://www.linkedin.com), xr-spatial-tracking=(), clipboard-write=self, clipboard-read=self, interest-cohort=()";
END_extraHeaders
}

Step 4: Apply the Configuration #

After updating the configuration, restart LiteSpeed to apply the changes:

systemctl restart lsws && killall -9 lsphp

Add Custom Security Headers on NGINX Servers in xCloud #

For NGINX-based xCloud servers, you can add custom security headers right from the xCloud Dashboard.ย 

Read this documentation for more information about custom NGINX:

๐Ÿ‘‰How To Configure Custom NGINX In xCloud?

๐Ÿ“Œ Notes

  • Do not edit vhconf.conf directly โ€“ it’s automatically regenerated by the xCloud panel.
  • Use vhconf.server.conf on OLS servers to retain customizations.
  • Always restart LiteSpeed or NGINX after making changes for them to take effect.

And thatโ€™s it this is how easily you can add custom security headers in xCloud for OLS and NGINX servers. Adding custom security headers is a crucial step in hardening your website against common threats such as cross-site scripting, clickjacking, and data injection attacks.I’s important to apply these headers in a way that aligns with the platformโ€™s configuration management to avoid losing changes during updates. 

Still stuck? Contact our support team for any of your queries.

What are your feelings
Updated on April 21, 2025

Server Name

RAM

SSD

xCloud Provider Price/m
(For LTD users)

VULTR Price/m

DO Price/m

Newcomer

1GB

25GB

$4.50

$5.00

$6.00

Basic

2GB

55GB

$9.00

$10

$12.00

Standard

4GB

80GB

$18.00

$20

$24.00

Professional

8GB

160GB

$36.00

$40

$48.00

Business

16GB

320GB

$72.00

$80

$96.00

Server Name

RAM

SSD/NVMe

xCloud Provider Price/m
(For LTD users)

VULTR Price/m

DO Price/m

Lite

1GB

32GB

$5.40

$6.00

$8.00

Personal

2GB

88GB

$16.20

$18.00

$24.00

Growing

4GB

128GB

$21.60

$24.00

$32.00

Elite

8GB

256GB

$43.20

$48.00

$64.00

Titanium

8GB

384GB

$86.40

$96.00

$96.00

Ultimate

32GB

512GB

$172.80

$192.00

$192.00