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

# TLS-proxy

En valgfri TLS-proxy til at afslutte HTTPS-forbindelser ved hjælp af NGINX.

Kør `bin/init --tls` for at initialisere lokal konfiguration med NGINX-proxykonfiguration eller for at tilføje NGINX-proxykonfiguration til en eksisterende lokal konfiguration. En **eksempel** privat nøgle oprettes i `config/nginx/certs/overleaf_key.pem` og et **fiktivt** certifikat i `config/nginx/certs/overleaf_certificate.pem`. Enten udskift disse med din faktiske private nøgle og certifikat, eller sæt værdierne for `TLS_PRIVATE_KEY_PATH` og `TLS_CERTIFICATE_PATH` variablerne til stierne for henholdsvis din faktiske private nøgle og dit certifikat.

En standardkonfiguration til NGINX findes i `config/nginx/nginx.conf` som kan tilpasses efter dine behov. Stien til konfigurationsfilen kan ændres med `NGINX_CONFIG_PATH` variablen.

{% hint style="success" %}
Hvis du har en **docker-compose.yml** baseret deployment, eller selv administrerer din egen NGINX reverse proxy, kan du se et eksempel **nginx.conf** fil [her](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/nginx.conf).
{% endhint %}

Tilføj følgende sektion til din `config/overleaf.rc` fil, hvis den ikke allerede er der:

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

# Erstat disse IP-adresser med værtsmaskinens eksterne IP-adresse
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" %}
Hvis du bruger en ekstern TLS-proxy (dvs. ikke administreret af Overleaf Toolkit), skal du sikre, at `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<ip-of-your-tls-proxy>` er angivet i din `config/variables.env`, f.eks. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,192.168.13.37`.
{% endhint %}

{% hint style="danger" %}
Hvis du bruger et subnet fra `172.16.0.0/12` (standard-subnet for Docker-netværk) til dit lokale netværk, skal du angive `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<network>` i din `config/variables.env`. Hvor `<network>` er `IPAM -> Config -> Subnet` værdi i `docker inspect overleaf_default`, f.eks. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,172.19.0.0/16`. Dette er for at forhindre spoofing af `X-Forwarded` headere.
{% endhint %}

{% hint style="info" %}
Hvis `OVERLEAF_TRUSTED_PROXY_IPS` ikke er angivet manuelt, er standardværdien `loopback`. Hvis du angiver det manuelt, skal du sørge for at inkludere en af `loopback`, `localhost` eller `127.0.0.1`, som betror **nginx** instansen, der kører inde i **sharelatex** containeren.
{% endhint %}

Hvis du har konfigureret de betroede proxy-IP'er korrekt, bør du se din offentlige IP-adresse på `/user/sessions` siden sådan her:

<figure><img src="/files/9b03d742165b2cd735605974bfb2dbce25aeaaba" alt="" width="375"><figcaption></figcaption></figure>

Hvis IP-adressen, der vises ovenfor, stadig er noget i stil med `127.0.0.1` eller en privat/lokal netværks-IP-adresse, så tjek venligst din betroede proxy-konfiguration, især værdien af `OVERLEAF_TRUSTED_PROXY_IPS`.

For at køre proxyen skal du ændre værdien af `NGINX_ENABLED` variablen i `config/overleaf.rc` fra `false` til `true` og kør igen `bin/up`.

Som standard vil HTTPS-webgrænsefladen være tilgængelig på `https://127.0.1.1:443`. Forbindelser til `http://127.0.1.1:80` vil blive omdirigeret til `https://127.0.1.1:443`. For at ændre den IP-adresse, som NGINX lytter på, skal du sætte `NGINX_HTTP_LISTEN_IP` og `NGINX_TLS_LISTEN_IP` variablerne. Portene kan ændres via `NGINX_HTTP_PORT` og `TLS_PORT` variablerne.

Hvis NGINX ikke kan starte med fejlmeddelelsen `Error starting userland proxy: listen tcp4 ... bind: address already in use` sørg for at `OVERLEAF_LISTEN_IP:OVERLEAF_PORT` ikke overlapper med `NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT`.

```mermaid
sequenceDiagram
participant user as Bruger
participant external as Ekstern vært
participant internal as Intern vært
participant nginx as nginx
participant sharelatex as sharelatex
participant git-bridge as git-bridge
%% Brugeren forbinder til ekstern vært 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
%% Brugeren forbinder til ekstern vært 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
%% Brugeren forbinder til localhost HTTP
user->>+ internal: HTTP
note over internal: OVERLEAF_LISTEN_IP:OVERLEAF_PORT
internal->>+sharelatex: HTTP
note over sharelatex: sharlatex:80
%% sharelatex forbinder til 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/da/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.
