When sharing your AFFiNE instance with others or publishing docs on the internet, use a recognizable host name instead of exposing your device IP address directly. Add SSL/TLS, also known as HTTPS, for basic transport security.
The most common way to publish AFFiNE under a domain with HTTPS is to use a reverse proxy. Common reverse proxy tools include Nginx, Caddy, and Apache HTTP Server.
This page demonstrates Nginx and Caddy examples.
WebSocket is required for the AFFiNE sync and collaboration system. Make sure your proxy allows WebSocket traffic.
Use a host name such as affine.example.com for reverse proxy configuration. Do not include https:// in server_name.
The external URL is the full public URL prefix for AFFiNE shareable links, such as https://affine.example.com. Set it in the Admin Panel after the reverse proxy is working.
Nginx is a common reverse proxy for web applications.
Below is an example Nginx configuration for proxying AFFiNE requests.
Caddy is a straightforward reverse proxy with integrated HTTPS support.
After setting up the reverse proxy, AFFiNE should be available at your own host, similar to https://app.affine.pro.
One more step is required.
Go to Admin -> Settings -> Server and set external url to the full public URL you used for the reverse proxy, such as https://affine.example.com. AFFiNE uses this value to generate links that other people can access, such as invitation links and public doc links.