When sharing your AFFiNE instance with others or publishing docs on the internet, you propably don't want to expose the IP of your device directly but a recognizable host instead. With SSL/TLS(known as HTTPS) to gain the basic security.
The most taken way to do these is Reverse Proxy. There are bunch of Reverse Proxy tools, nginx, caddy, Apache HTTP Server, etc.
nginx
and caddy
are both lightweight and easy-to-use ones, so we will demostrate they two.
Websocket is the basement of AFFiNE sync and colleboration system. Make sure your proxy allows websocket traffic.
The url of the prefix for all AFFiNE sharable links. It's required for enabling reverse proxy.
Nginx is a well known reverse proxy and almost the first candidate what to build web on top of.
Below is an example to demostrate how to config nginx to proxy AFFiNE request.
Caddy is a much more straight-forward. It provied integrated HTTPS on the go.
After setting up reverse proxy, AFFiNE should now be available at your own host, like we've set for https://affine.app.pro.
But there is one more thing needs to be done.
Go Admin -> Settings -> Server
and set external url
to the host you just used in reverse proxy. It used to tell AFFiNE server how to build the links that others can access instance. For example an invitation link or public doc link.