Why Rocket.Chat CSP and CORS settings matter for your workspace
Content Security Policy (CSP) controls which sources a browser will load scripts, styles, frames and other resources from, and CORS (Cross-Origin Resource Sharing) controls which other web origins may call your Rocket.Chat server from a browser. Teams usually need to change them in two situations: when a security review asks for a tighter browser policy on a self-hosted workspace, or when another web application must embed Rocket.Chat or call its APIs from a different origin. Both settings live in the Rocket.Chat administration panel, and exact setting names differ between versions, so confirm them in the panel for the version you run before you plan changes.
The usual risk is not the default alone but the allowlist that grows over time. Teams add a broad host, a wildcard or a whole domain to unblock one integration, then forget it. Every extra script source widens what an attacker can run in a user's session if an injection flaw appears, and every extra cross-origin caller widens who can read responses in a browser. A review will ask who requested each entry, what it is for and whether it is still needed. Keep a written record of each allowed origin with its owner, purpose and review date.
Embedding is the main reason to relax CORS, and it deserves its own decision. Allowing an external site to frame or call a workspace is a business requirement, so the scope should name the exact origins and the features they need. Your team should also confirm how your Rocket.Chat version handles frame embedding and cookies across sites, because a change that works in a test browser may behave differently in the browsers your users run. Plan a test of each allowed origin before the change reaches production.
Where CSP and CORS sit between users, proxy and Rocket.Chat
The request starts in the user's browser, which loads the Rocket.Chat web client through the reverse proxy or load balancer. That layer is where most security headers are set, including the Content Security Policy, so it is the first place to check. The browser enforces CSP on every page it renders, while CORS is checked when a page on another origin, such as an embedding site, makes a cross-origin request to Rocket.Chat. Verify that the proxy passes headers through unchanged and that each hand-off matches the origins you intend to allow.
Request path showing where the proxy sets headers and where the browser enforces CSP and CORS.
Which script domains to allow and why broad hosts are risky
The safest starting point is to allow scripts only from the origin that serves Rocket.Chat itself. In a standard self-hosted deployment, most of the application's JavaScript is served from your own domain, so a policy built on 'self' covers the core client without opening anything else. Keep in mind that the exact set of scripts depends on the Rocket.Chat version and the integrations you have enabled, so treat this as the baseline rather than a finished list.
- Core client code: The web client and its bundled assets are served from the same origin as the workspace, so
'self'is usually the first source to confirm. - Reverse proxy rewrites: If a proxy rewrites paths or moves assets to a separate static host,
'self'may no longer match what the browser loads. - Inline script: Avoid
'unsafe-inline'inscript-src. If a feature appears to need it, find the feature's loading method before widening the policy. - Version drift: A policy that works on one release can break after an upgrade that changes bundle paths, so retest after every version change.
- Review question: Can every script the workspace loads be traced to a file served from your own domain?
Check the baseline in staging by loading each main screen and watching the browser console for blocked script reports.
Some deployments load scripts from third parties, such as an analytics tool, a video conferencing provider or a error-reporting service. Each named host should be added individually, after someone confirms that the workspace actually loads from it. A host that appears in a list because it might be needed is an unreviewed trust relationship, and the browser will run whatever that host serves.
- Named host, exact origin: Allow the specific host, such as a single vendor's script domain, rather than its whole parent domain.
- Business justification: Record which feature loads the script and which team owns that feature.
- Vendor change control: A vendor can change the file served from its host at any time, so the trust you extend includes that vendor's own security practices.
- Integration-driven needs: Video and identity integrations often add their own script sources. Confirm each one against the integration's own documentation and your Rocket.Chat version.
- Review question: Which feature loads this host, who approved it, and what happens to the workspace if the vendor's script is compromised?
After adding a host, confirm in staging that the feature works and that no other unexpected host is requested.
Wildcard subdomains such as *.example-cdn.com, or broad public CDN hosts that serve thousands of customers, are the highest-risk entries in a script policy. Anyone who can publish content under a wildcard or a shared CDN path can often serve script that the policy will accept. The policy then stops protecting the workspace from injected code, which is the reason the policy exists.
- Shared hosting risk: On a shared CDN, the allowed host also serves files uploaded by other customers, and some of those files may be hostile.
- Subdomain takeover: A wildcard trusts every current and future subdomain, including ones whose owner may have abandoned them.
- Hidden dependencies: A broad host can make it harder to see which script actually ran, which weakens investigation after an incident.
- Compliance evidence: Auditors and security reviewers will ask why a wildcard is needed. Without a specific answer, the entry is hard to defend.
- Review question: Can you name the exact file path and host that the feature loads, and would you still accept the entry if you could only allow that one path?
If a wildcard or CDN is unavoidable, replace it with the specific host, and test in staging that removing the wildcard does not break the feature.
The list of allowed script domains should come from observation, not memory. Load each workspace screen you use, with each enabled integration active, and record every script origin the browser requests. Compare that inventory with the directives you plan to set, and remove anything that you cannot explain. Because the directives Rocket.Chat needs depend on version and enabled integrations, this inventory must be repeated for each release you run.
- Browser inventory: Use the browser's developer tools network view on each main screen, including admin pages, to list every script origin.
- Enabled integrations: Repeat the inventory with each integration turned on, since each one can add its own script host.
- Staging first: Apply the policy in report-only mode or in a staging workspace, then fix blocked resources before enforcing it in production.
- Document each entry: Keep a register that lists each host, the feature that needs it, the owner and the date reviewed.
- Review question at each upgrade: Which entries are still needed, which are new, and which can be removed?
Before enforcing the policy, confirm that every blocked request in staging has a documented owner and a decision.
CSP and CORS configuration options and when each fits
This table compares the main CSP and CORS choices for a self-hosted Rocket.Chat workspace, from the strictest default to the cases where an embedding or integration needs an exception. Read each row as a decision: the option, when it fits, the main risk it carries, and what to confirm in your own environment before changing a setting. The main takeaway is that every relaxation should be tied to a named host or origin that a team can justify.
| Option | When it fits | Main risk | What to confirm |
|---|---|---|---|
| Strict CSP with first-party sources only | Default choice for a workspace that loads no third-party scripts, widgets or embedded tools | Features that quietly depend on external hosts may break, so users report errors rather than the policy being revisited | Which browser features and apps fail under the current policy in a test workspace |
| CSP allowing specific named integration hosts | A known integration, such as a vetted app or embedded service, must load its script or frame | Each added host widens what injected code can run, and a host you do not control can change its content | The exact host names needed, who owns each one, and whether the vendor documents them |
| CORS disabled or limited to the same origin | Users access Rocket.Chat only from its own domain and no other site calls its APIs from a browser | Very little exposure from cross-origin calls, though some integrations that run in a browser will fail | Whether any browser-based integration or internal tool calls the Rocket.Chat API directly |
| CORS allowing one named embedding origin | A single site, such as an intranet portal, must embed or call Rocket.Chat from the browser | Trust extends to everything that site serves, so a compromise there can reach authenticated sessions | The embedding site's owner, its exact origin including scheme and port, and whether a server-side proxy would avoid the need |
| Wildcard origin value | Rarely justified for a workspace that holds private messages and files | Any website can make cross-origin requests to the API from a visitor's browser, which weakens the browser's protection for logged-in users | Whether any setting or proxy header still sends a wildcard, and whether the admin documentation for your version allows a narrower value |
| Null origin value | Almost never justified; it appears when requests come from sandboxed frames or local files | Requests from sandboxed or unexpected contexts can be accepted, and attackers can craft requests that send a null origin | Whether any legitimate client depends on it and whether it can be replaced with a named origin |
Why wildcard and null CORS values are dangerous
CORS decides which browser origins can read responses from Rocket.Chat. The hazards below share one root cause: an origin check that is wider than the set of sites that actually need access. Each card names the failure mode and the control to apply instead.
Wildcard origin exposes responses
A wildcard Access-Control-Allow-Origin value lets any website make cross-origin requests and read the responses in a visitor's browser. For a chat server, that means a page a user opens elsewhere could read data returned to that user's session. Replace the wildcard with an explicit list of origins that embed or call Rocket.Chat, and review that list whenever an integration is added.
Reflected Origin header without validation
Some proxies and custom configurations copy whatever value arrives in the request Origin header back into the response. The effect is the same as a wildcard, but it can also be combined with credentials, so it is easy to miss in testing. Validate the incoming origin against a fixed allowlist and return it only on a match, with no fallback.
Accepting the null origin
Sandboxed iframes, file:// pages and some redirected requests send the origin null. Allowing null lets an attacker's page in a sandbox make authenticated reads, because the browser reports that origin for it. Do not add null to any allowlist. If a local tool needs access, give it a real origin and an explicit entry.
Credentials with permissive origins
Browsers refuse a wildcard when credentials are included, so administrators often 'fix' the error by reflecting origins or widening the list. This keeps session cookies or authorization headers available to sites that were never meant to hold them. Only enable credentialed CORS for origins you control, and confirm that the same origins are the only ones allowed to send cookies.
Trusting proxy-supplied headers
Reverse proxies can add or rewrite Origin, forwarded host and scheme headers. If Rocket.Chat or its middleware trusts these values without checking that the request came through the proxy, a client can supply its own. Confirm which proxy sets these headers, strip client-supplied copies at the edge, and test the allowlist with forged values.
Copying settings from forum posts
Community answers often suggest wildcard origins, disabled checks or null values as quick fixes for embedding errors. These snippets are written for one installation and rarely match your domains, proxy or authentication model. Derive each origin from a documented integration need, record who approved it, and retest the policy after every upgrade.
How to set CSP and CORS in a Rocket.Chat deployment
This sequence turns a vague wish for tighter browser security into a documented, tested CSP and origin list that matches the hosts your workspace actually loads. It ends with a change record and a review step that runs after each upgrade.
Inventory every external host the workspace loads
The administrator, with a security engineer, loads the workspace in a browser with developer tools open and records every script, style, frame, font, image and connection target that is not served from the Rocket.Chat origin itself. Include the identity provider login pages, video conferencing frames, the push and cloud endpoints the server calls, and any app or Marketplace assets. Check that the list is complete by running the same walkthrough for login, a channel, a file preview and an admin page, then confirming that no new host appears. The output is a host list with a reason beside each entry.
Confirm which origins need cross-origin access
Decide which external sites actually need to call Rocket.Chat from their own pages, such as an embedded widget on a company website or an integration that reads the REST API from a browser. Each origin should be named with its exact scheme, host and port, and tied to a business owner who can explain the need. Most deployments find that the default same-origin behavior covers the core client and that CORS is needed only for a short list. The check is a signed-off table where every origin has an owner and a stated purpose, and any origin without one is dropped.
Draft the narrowest CSP and origin list in staging
Using the host inventory, the administrator writes the Content Security Policy directives and the CORS allowed origin values in a staging instance that mirrors production's domain, proxy and identity setup. Prefer specific hosts over broad wildcard domains, and avoid the wildcard value and the null origin for CORS, since either can let unintended pages read responses. Where the admin interface offers the setting, enter the values there; confirm the exact setting names and their location in the admin panel against the running version before changing anything, because they can differ between release lines. The check is a staging policy that loads the client without console violations for the inventoried hosts.
Set proxy headers consistently with the application
The infrastructure team aligns the reverse proxy or load balancer with the application so that the headers Rocket.Chat sees match what the browser receives. This covers the forwarded protocol and host headers, TLS termination, and any header the proxy adds or strips, including any security header set in both places. Duplicate or conflicting Content Security Policy headers from the proxy and the application can break the client or silently weaken protection, so exactly one source should own each header. The check is a response-header capture from the staging URL that shows one policy and the expected CORS values for each tested origin.
Test login, calls, previews and client apps
The QA owner runs a scripted test plan covering sign-in through the identity provider, starting a video call, opening an uploaded file preview, loading an embedded or integrated page, and using the admin console. The same plan is repeated on the official desktop and mobile clients, since they connect differently from the browser and can fail on a policy the web client passes. Record each blocked resource from the browser console and the server logs, then either add the narrowest justified host or fix the cause. The check is a passed run for every item on each client type, with no unexplained violations left.
Record the approved policy and its owners
The security owner writes a change record containing the final directive values, the CORS origin list, the reason for each host, the staging test results and the approver's name and date. The record also names where the settings live in the running version, so the next person can find them without guessing. Store the record in the same change system used for other production controls. The check is a record that another engineer can use to reproduce the configuration on a new instance without asking the original author.
Promote the change and monitor for breakage
After approval, the administrator applies the same settings to production in a planned window and repeats a short smoke test covering sign-in, a message with a link preview, a file preview and one embedded origin. The team watches browser error reports and support tickets for blocked resources over the following days, since users on unusual browsers or integrations are the ones most likely to surface a missing host. Any new host requires the same inventory and approval steps before it is added. The check is a production smoke test that passes and a log of any follow-up changes linked to the change record.
Review the policy after every upgrade
Each Rocket.Chat upgrade, including patch releases, is followed by a review of the release notes for changes to client scripts, frames, connection targets or security headers, and by a rerun of the inventory walkthrough. Upgrades can add or move hosts, so a policy that passed before may block a new feature after the update. The security owner repeats the test plan on staging before production, and updates the change record with any directive changes. The check is a dated review entry for each upgrade that confirms the policy still matches the inventory.
Security and operational considerations after you change these settings
A CSP and CORS policy is not a one-time setting. The proxy, the application and the browser clients all have to agree on it, and each upgrade can change which hosts the product needs. The cards below cover the routine checks that keep the policy correct, reviewable and current.
Keep proxy and app headers aligned
Check whether your reverse proxy adds, overrides or strips the Content-Security-Policy and Access-Control-Allow-Origin headers before the application sends its own. A header set in two places can be merged, duplicated or silently dropped, and browsers may then enforce a policy you did not write. Test the response headers with a request from the real proxy path after every change to the proxy configuration.
Review the policy after each upgrade
New features can load scripts, styles, frames or API calls from hosts the previous release never used. Compare the current policy against the release notes for the version you are moving to, then test the features your users depend on in a staging copy before production. Plan this review as part of every upgrade, not as a separate project.
Version durability docsWatch browser console reports
Blocked resources appear in the browser developer console as policy violations, and some setups can send these reports to a collection endpoint. Review them during rollout and after upgrades to find legitimate hosts you missed and unexpected hosts that appear. Confirm in your own environment which reporting options your browsers and proxy support before you rely on them.
Protect admin access to these settings
Anyone who can change CSP or CORS values can weaken the browser protections for every user of the workspace. Limit the administrator role for these settings to a small named group, require multi-factor authentication for those accounts, and review who holds the role on a regular schedule. Confirm with your vendor how the workspace records changes made through the admin interface.
Keep change records for reviews
Security reviewers will ask what the policy is, when it changed and who approved the change. Record each change with the date, the hosts added or removed, the reason, the requester, the approver and the test evidence. Store the policy text alongside the proxy configuration in version control so the two can be compared during an audit.
Track the policy in patch cycles
Include the CSP and CORS configuration in your advisory tracking and patch calendar, since a security fix or version change can alter what the application needs. When an advisory requires an upgrade, repeat the header review and console check before the change reaches users. Keep the policy in the same change process as the rest of the platform.
Rocket.Chat releasesQuestions teams ask before changing Rocket.Chat CSP or CORS
Can our own team change Rocket.Chat CSP and CORS settings without a partner?
Yes, if you have an administrator who can read your reverse proxy and Rocket.Chat configuration, a staging copy that matches production, and time to test every page that loads external content. The settings themselves are administrative toggles, so the risk lies in gaps: a missing script domain breaks a feature silently, and a broad allowance weakens protection without any visible error. Teams without a browser security background often use a partner for the first pass, then keep the resulting policy under their own change control. Confirm who will own the policy after handover before you start.
What makes a Rocket.Chat CSP or CORS change take more effort?
Effort rises with the number of places that load or call Rocket.Chat from elsewhere. The main drivers are:
- Integrations and apps that load scripts, frames or API calls from third-party domains
- Any plan to embed Rocket.Chat pages or the Livechat widget in your own websites
- Reverse proxies, load balancers and CDNs that add or rewrite headers, since duplicated or conflicting headers are common
- How much test coverage exists for login, file preview, video calls and admin pages
Each additional integration usually means another domain to justify, test and document with an owner.
How long does a CSP and CORS change take, and does a fixed-scope engagement help?
Duration depends on scope, not on the settings alone. A workspace with a short list of known domains and a single proxy is a much smaller job than one with many embedded pages and several integrations. Inventory, staging tests and sign-off from integration owners usually take more time than the configuration edits. A fixed-scope engagement helps when you want the inventory, policy, test plan and retest agreed in writing before work starts, so the effort and deliverables are visible. DeployOpen does not publish prices or fixed timelines; a quote follows from the written scope, and you should ask for the assumed number of integrations, environments and test cycles in that quote.
What do we need to provide before a CSP or CORS review starts?
The work goes faster when you prepare these items first:
- A list of every integration, app, widget and embedding site that loads content from or calls Rocket.Chat
- A staging environment that uses the same proxy, TLS and hostnames as production
- A named owner for each integration who can confirm which domains it needs and test its features
- Current copies of your reverse proxy and Rocket.Chat header settings
- A change window and rollback plan agreed with operations
Without the owner list, the team tends to allow domains on guesswork, and those allowances are hard to remove later.
Will changing CSP break the Rocket.Chat mobile or desktop clients?
A CSP change is most likely to affect the web interface and any embedded pages, not the native mobile and desktop clients, which do not render the web app's pages in the same way. Still, do not assume this. Test sign-in, message sending, file uploads and notifications on each client version your users run, against a staging server with the new policy. Your team should also confirm with Rocket.Chat's documentation which client versions a given server version supports, because support for older clients depends on the server release line.
How do CSP and CORS changes fit with Rocket.Chat upgrades and security advisories?
Treat these settings as part of your release process. Upgrades can change the default headers, the scripts the web app loads or the endpoints that need cross-origin access, so review the policy after each upgrade and before applying one. Security patches sometimes need to be applied quickly, which leaves little time for a full policy review, so keep a tested staging copy and a documented policy in version control to speed up that review. Confirm the support window of your current release line before planning, since end-of-life versions receive no security fixes.
Who should sign off on a Rocket.Chat CSP or CORS policy?
Sign-off should include the security owner who accepts the risk of each allowed domain, the platform owner who runs the proxy and upgrades, and an owner for each integration that needs a domain. Compliance staff may also need to review the policy if your records or data handling rules depend on which third parties can load content in user sessions. Record each approved domain with its purpose, owner and review date. This record is the evidence most reviewers ask for, and it makes later removals safer.
How DeployOpen works on this
DeployOpen approaches Rocket.Chat Content Security Policy and CORS settings as a scoped piece of work inside your own infrastructure, starting from the exact domains your users, integrations and embeds depend on. The work is agreed in writing before any change is made, and the resulting settings are tested in your environment and documented for your security and operations teams.
How we scope
- Inventory the script, style, frame and media origins your workspace and integrations actually load before changing any policy.
- Identify which embedding or cross-origin integrations need CORS, and which origins they require, in the written scope.
- Agree in writing which browser clients, deployment topology and proxy layer the CSP and CORS settings must cover.
How we build
- Configure the Content Security Policy in report-only mode first, then review violation reports before enforcing the policy.
- Replace broad host entries and any wildcard or null CORS origins with explicit origins tied to named integrations.
- Test login, message rendering, file previews, embedded content and mobile or desktop client connections against the final settings.
How we hand over
- Deliver a written record of each allowed origin, the integration or feature that requires it, and the reason it is needed.
- Document the rollback steps and the settings that must be reviewed after each Rocket.Chat upgrade or proxy change.
- Walk your security and platform engineers through the test results and the open items that need your decision.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so policy changes can be reviewed as integrations change.
- Re-test CSP and CORS behavior when Rocket.Chat is upgraded, since the required origins can change between releases.
- Confirm with your team which settings a retainer should cover before agreeing the scope of ongoing work.

