faet(docs): document the new CORS options

This commit is contained in:
Elian Doran 2025-04-17 20:00:46 +03:00
parent 2babc2c5d9
commit 8e7f0f6478
No known key found for this signature in database
4 changed files with 73 additions and 1 deletions

View File

@ -9968,6 +9968,26 @@
"format": "markdown", "format": "markdown",
"dataFileName": "Trilium instance.md", "dataFileName": "Trilium instance.md",
"attachments": [] "attachments": []
},
{
"isClone": false,
"noteId": "LWtBjFej3wX3",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"Gzjqa934BdH4",
"LWtBjFej3wX3"
],
"title": "Cross-Origin Resource Sharing (CORS)",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [],
"format": "markdown",
"dataFileName": "Cross-Origin Resource Sharing .md",
"attachments": []
} }
] ]
}, },

View File

@ -0,0 +1,6 @@
# Cross-Origin Resource Sharing (CORS)
By default, Trilium cannot be accessed in web browsers by requests coming from other domains/origins than Trilium itself. 
However, it is possible to manually configure [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) since Trilium v0.93.0 using environment variables or `config.ini`, as follows:
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col style="width:26.93%;"><col style="width:32.46%;"><col style="width:40.61%;"></colgroup><thead><tr><th>CORS Header</th><th>Corresponding option in <code>config.ini</code></th><th>Corresponding option in environment variables in the <code>Network</code> section</th></tr></thead><tbody><tr><td><code>Access-Control-Allow-Origin</code></td><td><code>TRILIUM_NETWORK_CORS_ALLOW_ORIGIN</code></td><td><code>corsAllowOrigin</code>&nbsp;</td></tr><tr><td><code>Access-Control-Allow-Methods</code></td><td><code>TRILIUM_NETWORK_CORS_ALLOW_METHODS</code></td><td><code>corsAllowMethods</code>&nbsp;</td></tr><tr><td><code>Access-Control-Allow-Headers</code></td><td><code>TRILIUM_NETWORK_CORS_ALLOW_HEADERS</code></td><td><code>corsAllowHeaders</code></td></tr></tbody></table></figure>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,46 @@
<p>By default, Trilium cannot be accessed in web browsers by requests coming
from other domains/origins than Trilium itself.&nbsp;</p>
<p>However, it is possible to manually configure <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS">Cross-Origin Resource Sharing (CORS)</a> since
Trilium v0.93.0 using environment variables or <code>config.ini</code>,
as follows:</p>
<figure class="table" style="width:100%;">
<table class="ck-table-resized">
<colgroup>
<col style="width:26.93%;">
<col style="width:32.46%;">
<col style="width:40.61%;">
</colgroup>
<thead>
<tr>
<th>CORS Header</th>
<th>Corresponding option in <code>config.ini</code>
</th>
<th>Corresponding option in environment variables in the <code>Network</code> section</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Access-Control-Allow-Origin</code>
</td>
<td><code>TRILIUM_NETWORK_CORS_ALLOW_ORIGIN</code>
</td>
<td><code>corsAllowOrigin</code>&nbsp;</td>
</tr>
<tr>
<td><code>Access-Control-Allow-Methods</code>
</td>
<td><code>TRILIUM_NETWORK_CORS_ALLOW_METHODS</code>
</td>
<td><code>corsAllowMethods</code>&nbsp;</td>
</tr>
<tr>
<td><code>Access-Control-Allow-Headers</code>
</td>
<td><code>TRILIUM_NETWORK_CORS_ALLOW_HEADERS</code>
</td>
<td><code>corsAllowHeaders</code>
</td>
</tr>
</tbody>
</table>
</figure>