Advanced configuration options for GoToSocial.

Can I host my instance at but have just in my username?

Yes, you can! This is useful when you have something like a personal page or blog at, but you also want your fediverse account to have in it to avoid confusing people, or just because it looks nicer than

Please note that you need to do this BEFORE RUNNING GOTOSOCIAL for the first time, or things will likely break.

Step 1: Configure GoToSocial

This step is easy.

In the settings, GoToSocial differentiates between host--the address at which your instance is accessible--and account-domain--which is the domain you want to show in accounts.

Behold, from the example config.yaml file:

# String. Hostname that this server will be reachable at. Defaults to localhost for local testing,
# but you should *definitely* change this when running for real, or your server won't work at all.
# DO NOT change this after your server has already run once, or you will break things!
# Examples: ["",""]
# Default: "localhost"
host: "localhost"

# String. Domain to use when federating profiles. This is useful when you want your server to be at
# eg., "", but you want the domain on accounts to be "" because it looks better
# or is just shorter/easier to remember.
# To make this setting work properly, you need to redirect requests at ""
# to "" so that GtS can handle them properly.
# You should also redirect requests at "" in the same way.
# An empty string (ie., not set) means that the same value as 'host' will be used.
# DO NOT change this after your server has already run once, or you will break things!
# Please read the appropriate section of the installation guide before you go messing around with this setting:
# Examples: ["",""]
# Default: ""
account-domain: ""

The first value, host, is simple. In our scenario of wanting to run the GtS instance at, this should be set to, yep,

The second value, account-domain should be set to, to indicate that that's the domain we want accounts to be displayed with.

IMPORTANT: account-domain must be a parent domain of host, and host must be a subdomain of account-domain. So if your host is, your account-domain cannot be or, it has to be

Step 2: Redirect from to

The next step is more difficult: we need to ensure that when remote instances search for the user via webfinger, they end up being pointed towards, where our instance is actually hosted.

Of course, we don't want to redirect all requests from to because that negates the purpose of having a separate domain in the first place, so we need to be specific.

In the config.yaml above, there are two endpoints mentioned, both of which we need to redirect: /.well-known/webfinger and /.well-known/nodeinfo.

Assuming we have an nginx reverse proxy running on, we can get the redirect behavior we want by adding the following to the nginx config for

http {
    server {
        listen 80;
        listen [::]:80;

        location /.well-known/webfinger {
            rewrite ^.*$ permanent;

        location /.well-known/nodeinfo {
            rewrite ^.*$ permanent;

        # The rest of our nginx config ...

The above configuration rewrites queries to and to their counterparts, which means that query information is preserved, making it easier to follow the redirect.

Step 3: What now?

Once you've done steps 1 and 2, proceed as normal with the rest of your GoToSocial installation.

Supplemental: how does this work?

With the configuration we put in place in the steps above, when someone from another instance looks up, their instance will perform a webfinger request to in order to discover a link to an ActivityPub representation of that user's account. They will then be redirected to, and their query will be resolved.

The webfinger response returned by GoToSocial (and indeed Mastodon, and other ActivityPub implementations) contains the desired account domain in the subject part of the response, and provides links to aliases that should be used to query the account.

Here's an example of this working for the GoToSocial instance, which is hosted at

Curl query:

curl -v ''


> GET /.well-known/webfinger? HTTP/2
> Host:
> user-agent: curl/7.68.0
> accept: */*
< HTTP/2 301 
< content-type: text/html
< date: Thu, 17 Nov 2022 11:10:39 GMT
< location:
< server: nginx/1.20.1
< content-length: 169
<head><title>301 Moved Permanently</title></head>
<center><h1>301 Moved Permanently</h1></center>

If we follow the redirect and make a query to the specified location as follows:

curl -v ''

Then we get the following response:

  "subject": "",
  "aliases": [
  "links": [
      "rel": "",
      "type": "text/html",
      "href": ""
      "rel": "self",
      "type": "application/activity+json",
      "href": ""

In the above response, note that the subject of the response contains the desired account-domain of, whereas the links contain the actual host value of

Can I make my GoToSocial instance use a proxy (http, https, socks5) for outgoing requests?

Yes! GoToSocial supports canonical environment variables for doing this: HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions thereof). HTTPS_PROXY takes precedence over HTTP_PROXY for https requests.

The http client that GoToSocial uses will be initialized with the appropriate proxy.

The environment values may be either a complete URL or a host[:port], in which case the "http" scheme is assumed. The schemes "http", "https", and "socks5" are supported.

Application sandboxing

Although GoToSocial does not currently have any known vulnerabilities, it's always a good idea to be proactive about security. One way you can help protect your instance is to run it in a sandbox -- an environment that constrains the actions a program can perform in order to limit the impact of a future exploit.

Using Docker to run GoToSocial can work as a (limited) sandboxing mechanism. For Linux installations, Linux Security Modules such as AppArmor and SELinux work as a complementary mechanism that typically provide stronger protections. You should use

  • AppArmor if you're running GoToSocial on Debian, Ubuntu, or OpenSUSE, and
  • SELinux if you're using CentOS, RHEL, or Rocky Linux.

For other Linux distributions, you will need to look up what Linux Security Modules are supported by your kernel.


GoToSocial is currently alpha software, and as more features are implemented these security policies may quickly become outdated. You may find that using AppArmor or SELinux causes GoToSocial to fail in unexpected ways until GTS becomes stable.


Sandboxing is an additional security mechanism to help defend against certain kinds of attacks; it is not a replacement for good security practices.


For Linux distributions supporting AppArmor, there is an AppArmor profile available in example/apparmor/gotosocial that you can use to confine your GoToSocial instance. If you're using a server (such as a VPS) to deploy GoToSocial, you can install the AppArmor profile by downloading it and copying it into the /etc/apparmor.d/ directory:

sudo install -o root -g root gotosocial /etc/apparmor.d/gotosocial
sudo apparmor_parser -Kr /etc/apparmor.d/gotosocial

If you're using Docker Compose, you should add the following security_opt section to your Compose configuration file:

      - apparmor=gotosocial

If you're running GoToSocial as a Systemd service, you should instead add this line under [Service]:


For other deployment methods (e.g. a managed Kubernetes cluster), you should review your platform's documentation for how to deploy an application with an AppArmor profile.

Disabling the AppArmor profile

If enabling the AppArmor profile causes your instance to experience issues, you can uninstall it from the system as follows:

sudo apparmor_parser -R /etc/apparmor.d/gotosocial
sudo rm -vi /etc/apparmor.d/gotosocial

You will also want to remove any changes you made to your Compose configuration or Systemd service file to enable the profile.



Currently, this SELinux policy only works for the binary installation method.

If SELinux is available on your system, you can optionally install SELinux policy to further improve security.