> 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/de/konfiguration/overleaf-toolkit/tls-proxy.md).

# TLS-Proxy

Ein optionaler TLS-Proxy zum Beenden von HTTPS-Verbindungen unter Verwendung von NGINX.

Ausführen `bin/init --tls` um die lokale Konfiguration mit der NGINX-Proxy-Konfiguration zu initialisieren oder die NGINX-Proxy-Konfiguration zu einer vorhandenen lokalen Konfiguration hinzuzufügen. Ein **Beispiel** privater Schlüssel wird erstellt in `config/nginx/certs/overleaf_key.pem` und ein **Platzhalter** Zertifikat in `config/nginx/certs/overleaf_certificate.pem`. Ersetzen Sie diese entweder durch Ihren tatsächlichen privaten Schlüssel und Ihr Zertifikat, oder setzen Sie die Werte der `TLS_PRIVATE_KEY_PATH` und `TLS_CERTIFICATE_PATH` Variablen auf die Pfade Ihres tatsächlichen privaten Schlüssels bzw. Zertifikats.

Eine Standardkonfiguration für NGINX ist enthalten in `config/nginx/nginx.conf` die an Ihre Anforderungen angepasst werden kann. Der Pfad zur Konfigurationsdatei kann mit der `NGINX_CONFIG_PATH` Variablen geändert werden.

{% hint style="success" %}
Wenn Sie eine **docker-compose.yml** basierte Bereitstellung haben oder Ihren eigenen NGINX-Reverse-Proxy verwalten, können Sie ein Beispiel einer **nginx.conf** Datei [hier](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/nginx.conf).
{% endhint %}

Fügen Sie den folgenden Abschnitt zu Ihrer `config/overleaf.rc` Datei hinzu, falls er noch nicht vorhanden ist:

```
# TLS-Proxy-Konfiguration (optional)
NGINX_ENABLED=false
NGINX_CONFIG_PATH=config/nginx/nginx.conf
NGINX_HTTP_PORT=80

# Ersetzen Sie diese IP-Adressen durch die externe IP-Adresse Ihres Hosts
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" %}
Wenn Sie einen externen TLS-Proxy verwenden (d. h. nicht vom Overleaf Toolkit verwaltet), stellen Sie bitte sicher, dass `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<ip-of-your-tls-proxy>` in Ihrer `config/variables.env`, z. B. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,192.168.13.37`.
{% endhint %}

{% hint style="danger" %}
Wenn Sie ein Subnetz von `172.16.0.0/12` (Standard-Subnetz für Docker-Netzwerke) für Ihr lokales Netzwerk verwenden, müssen Sie `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<network>` in Ihrer `config/variables.env`. Wobei `<network>` der `IPAM -> Config -> Subnet` Wert in `docker inspect overleaf_default`, z. B. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,172.19.0.0/16`. Dies dient dazu, das Spoofing von `X-Forwarded` Headern.
{% endhint %}

{% hint style="info" %}
Wenn die `OVERLEAF_TRUSTED_PROXY_IPS` nicht manuell gesetzt ist, ist der Standardwert `loopback`. Wenn Sie ihn manuell setzen, müssen Sie sicherstellen, dass Sie eines von `loopback`, `localhost` oder `127.0.0.1`einschließen, welches der **nginx** laufenden Instanz im **sharelatex** Container vertraut.
{% endhint %}

Wenn Sie die vertrauenswürdigen Proxy-IP-Adressen korrekt konfiguriert haben, sollten Sie Ihre öffentliche IP-Adresse auf der `/user/sessions` Seite wie folgt sehen:

<figure><img src="/files/8071bd99cb347c5944b6b5b1aad7dd6011d117e7" alt="" width="375"><figcaption></figcaption></figure>

Wenn die oben angezeigte IP-Adresse immer noch etwas wie `127.0.0.1` oder eine private/lokale Netzwerk-IP-Adresse ist, überprüfen Sie bitte Ihre Trusted-Proxy-Konfiguration, insbesondere den Wert von `OVERLEAF_TRUSTED_PROXY_IPS`.

Um den Proxy auszuführen, ändern Sie den Wert der `NGINX_ENABLED` Variablen in `config/overleaf.rc` von `false` zu `true` und führen Sie erneut aus `bin/up`.

Standardmäßig ist die HTTPS-Weboberfläche unter `https://127.0.1.1:443`. Verbindungen zu `http://127.0.1.1:80` werden umgeleitet zu `https://127.0.1.1:443`. Um die IP-Adresse zu ändern, auf der NGINX lauscht, setzen Sie die `NGINX_HTTP_LISTEN_IP` und `NGINX_TLS_LISTEN_IP` Variablen. Die Ports können über die `NGINX_HTTP_PORT` und `TLS_PORT` Variablen geändert werden.

Wenn NGINX mit der Fehlermeldung nicht startet `Error starting userland proxy: listen tcp4 ... bind: address already in use` stellen Sie sicher, dass `OVERLEAF_LISTEN_IP:OVERLEAF_PORT` sich nicht überschneidet mit `NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT`.

```mermaid
sequenceDiagram
participant user as User
participant external as Host External
participant internal as Host Internal
participant nginx as nginx
participant sharelatex as sharelatex
participant git-bridge as git-bridge
%% Benutzer verbindet sich per HTTP mit dem externen Host
user->>+ external: HTTP
note over external: NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT
external->>+ nginx: HTTP
note over nginx: nginx:80
nginx-->>-external: 301
%% Benutzer verbindet sich per HTTPS mit dem externen Host
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
%% Benutzer verbindet sich per HTTP mit localhost
user->>+ internal: HTTP
note over internal: OVERLEAF_LISTEN_IP:OVERLEAF_PORT
internal->>+sharelatex: HTTP
note over sharelatex: sharlatex:80
%% sharelatex verbindet sich mit 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/de/konfiguration/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.
