Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Conversation

@yiranlus
Copy link
Contributor

@yiranlus yiranlus commented Apr 15, 2025

This PR allows setting CORS headers:

  • Access-Control-Allow-Origin: by setting environment variable TRILIUM_NETWORK_CORS_ALLOW_ORIGIN, or corsAllowOrigin in Network section in config.ini.
  • Access-Control-Allow-Methods: by setting environment variable TRILIUM_NETWORK_CORS_ALLOW_METHODS, or corsAllowMethods in Network section in config.ini.
  • Access-Control-Allow-Headers: by setting environment variable TRILIUM_NETWORK_CORS_ALLOW_HEADERS, or corsAllowHeaders in Network section in config.ini.

For web browser, due to security reason, it doesn't allow other origins to access Trilium server, e.g., Open WebUI. Modifying these headers will avoid this restriction.

By default, I leave these values empty.

Closes TriliumNext/Trilium#5664

Copy link
Contributor

@pano9000 pano9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, you should also update the config-sample.ini file and add these under the "Network" section as well

@pano9000
Copy link
Contributor

thanks, will do a "live" test this evening (I'm in CEST timezone) and report back :-)

Copy link
Contributor

@eliandoran eliandoran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, even if I didn't test it. We can make adjustments later if needed.

@eliandoran eliandoran merged commit 6ca49e9 into TriliumNext:develop Apr 17, 2025
8 of 10 checks passed
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting Cross-Origin Resource Sharing (CORS) headers

3 participants