Using ONLYOFFICE Docs behind the proxy

Introduction

ONLYOFFICE Docs runs as an online application and often needs to be integrated into internal networks. Many networks use different web servers as proxies for certain purposes today. Thus, it is important to make ONLYOFFICE Docs workable behind the proxy. The most widespread web servers are NGINX and Apache, whose popularity is due to their flexibility, speed and power. Another well-known web server is HAProxy, which was originally designed to work as a load balancer. Træfik is also a popular modern reverse proxy and load balancer. This article provides ready-made configuration examples for running ONLYOFFICE Docs behind these four proxy servers.

To make ONLYOFFICE Docs accessible for client-side hosts, you need to set up forwarded HTTP headers. Their aim is to keep information about the client while the request goes to the server through the proxy. You need to set up two types of HTTP headers: X-Forwarded-Proto and X-Forwarded-Host. X-Forwarded-Proto header is a de facto standard header for identifying the protocol (HTTP or HTTPS) that a client used to connect to the proxy or load balancer. X-Forwarded-Host is a standard header for identifying the original host requested by the client in the Host HTTP request header.

There are three main scenarios in which you may need to configure a proxy. Here are examples of how each can be configured.

Common scenario (proxy to local server)

This scenario is used when you need to simply redirect the outbound traffic to the local server:

Here are the ready configurations for proxy:

Proxy HTTPS to HTTP

This scenario is used when you need to secure the connection so all the requests must be automatically redirected to HTTPS:

Here are the ready configurations for proxy:

Virtual path

This is a suitable scenario when you need to map a specific directory on your host to the path specified in the web server:

Here are the ready configurations for proxy:

Article with the tag:
Browse all tags