Using reverse proxy with ManicTime server

Reverse proxy headers


Reverse proxy must be configured to forward following headers to ManicTime server:
X-Forwarded-Proto: <protocol>
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto

X-Forwarded-Host: <host>
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host

Example:
X-Forwarded-Proto: https
X-Forwarded-Host: demo.manictime.com

Trusting reverse proxy


ManicTime server only trusts forwarded headers by known proxies. By default, only loopback addresses are configured as known proxies (127.0.0.1). If reverse proxy has a different IP address, it needs to be configured in ManicTimeServerSettings.json using CIDR notation (https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation):

{
"web": {
  "reverseProxy": {
    "addresses": [
      "<proxy ip address>"
    ],
    "networks": [
      "<proxy network>"
    ]
  }
}
}


Example 1: trust all proxies on all networks
{
"web": {
  "reverseProxy": {
    "addresses": [
      "*"
    ],
    "networks": [
      "*"
    ]
  }
}
}

Example 2: trust only proxies on a known IP address (IPv4 and IPv6)
{
"web": {
  "reverseProxy": {
    "addresses": [
      "10.0.0.1",
        "::ffff:10.0.0.1"
    ]
  }
}
}

Example 3: trust only proxies on a known network (IPv4 and IPv6)
{
"web": {
  "reverseProxy": {
    "networks": [
      "10.244.0.0/16",
        "::ffff:10.244.0.0/16"
    ]
  }
}
}

Troubleshooting


Unknown error: invalid_request
You get error 'Unknown error: invalid_request' when testing connection:

If you have configured redirects from http to https, make sure you are using temporary redirects (http status code 307) and not permanent redirects (http status code 301).

Still having problems?


Please send us ManicTime Server log files:
- on Windows they are in folder c:\ProgramData\ManicTime\Server\Logs. 
- on Mac and Linux, in folder where ManicTimeServer executable is, subfolder Data/Logs.
- on Docker, please send us Docker log files and ManicTime Server log files (where Data folder is, subfolder Logs)

Feedback and Knowledge Base