> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/nl/configuratie/overleaf-toolkit/tls-proxy.md).

# TLS-proxy

Een optionele TLS-proxy voor het beëindigen van HTTPS-verbindingen, met gebruik van NGINX.

Voer uit `bin/init --tls` om de lokale configuratie te initialiseren met NGINX-proxyconfiguratie, of om NGINX-proxyconfiguratie toe te voegen aan een bestaande lokale configuratie. Een **voorbeeld** privésleutel wordt aangemaakt in `config/nginx/certs/overleaf_key.pem` en een **dummy** certificaat in `config/nginx/certs/overleaf_certificate.pem`. Vervang deze door je eigen privésleutel en certificaat, of stel de waarden van de `TLS_PRIVATE_KEY_PATH` en `TLS_CERTIFICATE_PATH` variabelen in op respectievelijk de paden naar je eigen privésleutel en certificaat.

Een standaardconfiguratie voor NGINX wordt geleverd in `config/nginx/nginx.conf` die naar wens kan worden aangepast. Het pad naar het configuratiebestand kan worden gewijzigd met de `NGINX_CONFIG_PATH` variabele.

{% hint style="success" %}
Als je een **docker-compose.yml** gebaseerde implementatie hebt, of je eigen NGINX reverse proxy beheert, kun je hier een voorbeeld **nginx.conf** bestand [bekijken](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/nginx.conf).
{% endhint %}

Voeg de volgende sectie toe aan je `config/overleaf.rc` bestand als die er nog niet staat:

```
# TLS-proxyconfiguratie (optioneel)
NGINX_ENABLED=false
NGINX_CONFIG_PATH=config/nginx/nginx.conf
NGINX_HTTP_PORT=80

# Vervang deze IP-adressen door het externe IP-adres van je host
NGINX_HTTP_LISTEN_IP=127.0.1.1 
NGINX_TLS_LISTEN_IP=127.0.1.1
TLS_PRIVATE_KEY_PATH=config/nginx/certs/overleaf_key.pem
TLS_CERTIFICATE_PATH=config/nginx/certs/overleaf_certificate.pem
TLS_PORT=443
```

{% hint style="danger" %}
Als je een externe TLS-proxy gebruikt (d.w\.z. niet beheerd door de Overleaf Toolkit), zorg er dan voor dat `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<ip-of-your-tls-proxy>` is ingesteld in je `config/variables.env`, bijvoorbeeld `OVERLEAF_TRUSTED_PROXY_IPS=loopback,192.168.13.37`.
{% endhint %}

{% hint style="danger" %}
Als je een subnet uit `172.16.0.0/12` (standaard-subnet voor Docker-netwerken) gebruikt voor je lokale netwerk, moet je `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<network>` instellen in je `config/variables.env`. Waar `<network>` de `IPAM -> Config -> Subnet` waarde in `docker inspect overleaf_default`, bijvoorbeeld `OVERLEAF_TRUSTED_PROXY_IPS=loopback,172.19.0.0/16`. Dit is om het vervalsen van `X-Forwarded` headers te voorkomen.
{% endhint %}

{% hint style="info" %}
Als de `OVERLEAF_TRUSTED_PROXY_IPS` niet handmatig is ingesteld, staat deze standaard op `loopback`. Als je dit handmatig instelt, moet je ervoor zorgen dat je een van de `loopback`, `localhost` of `127.0.0.1`loopback **nginx** instantie die draait in de **sharelatex** container vertrouwt.
{% endhint %}

Als je de vertrouwde proxy-IP's correct hebt geconfigureerd, zou je je openbare IP-adres op de `/user/sessions` pagina moeten zien zoals dit:

<figure><img src="/files/3cc47b899c0a5d7b34e558e1bc066f6446c14608" alt="" width="375"><figcaption></figcaption></figure>

Als het hierboven getoonde IP-adres nog steeds iets is als `127.0.0.1` of een privé-/lokaal netwerk-IP-adres, controleer dan je configuratie van de vertrouwde proxy, vooral de waarde van `OVERLEAF_TRUSTED_PROXY_IPS`.

Om de proxy uit te voeren, wijzig de waarde van de `NGINX_ENABLED` variabele in `config/overleaf.rc` van `false` naar `true` en voer `bin/up`.

Standaard is de HTTPS-webinterface beschikbaar op `https://127.0.1.1:443`. Verbindingen naar `http://127.0.1.1:80` worden doorgestuurd naar `https://127.0.1.1:443`. Om het IP-adres te wijzigen waarop NGINX luistert, stel de `NGINX_HTTP_LISTEN_IP` en `NGINX_TLS_LISTEN_IP` variabelen in. De poorten kunnen worden gewijzigd via de `NGINX_HTTP_PORT` en `TLS_PORT` variabelen.

Als NGINX niet kan starten met de foutmelding `Error starting userland proxy: listen tcp4 ... bind: address already in use` zorg er dan voor dat `OVERLEAF_LISTEN_IP:OVERLEAF_PORT` niet overlapt met `NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT`.

```mermaid
sequenceDiagram
participant user as Gebruiker
participant external as Externe host
participant internal as Interne host
participant nginx as nginx
participant sharelatex as sharelatex
participant git-bridge as git-bridge
%% Gebruiker maakt verbinding met externe host HTTP
user->>+ external: HTTP
note over external: NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT
external->>+ nginx: HTTP
note over nginx: nginx:80
nginx-->>-external: 301
%% Gebruiker maakt verbinding met externe host HTTPS
user->>+ external: HTTPS
note over external: NGINX_TLS_LISTEN_IP:TLS_PORT
external->>+ nginx: HTTPS
note over nginx: nginx:443
nginx->>+ sharelatex: HTTP
note over sharelatex: sharlatex:80
%% Gebruiker maakt verbinding met localhost HTTP
user->>+ internal: HTTP
note over internal: OVERLEAF_LISTEN_IP:OVERLEAF_PORT
internal->>+sharelatex: HTTP
note over sharelatex: sharlatex:80
%% sharelatex maakt verbinding met git-bridge
sharelatex->>+git-bridge: HTTP /git/
note over git-bridge: git-bridge:8000
note over sharelatex: GIT_BRIDGE_HOST:GIT_BRIDGE_PORT
git-bridge->>+sharelatex: WEB/WEB-API:3000
git-bridge->>+sharelatex: HISTORY-V1:3100
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/nl/configuratie/overleaf-toolkit/tls-proxy.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
