> For the complete documentation index, see [llms.txt](https://docs.netmap.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.netmap.dev/install-and-upgrade/reverse-proxy.md). Agents can also search and read this documentation through its [MCP server](https://docs.netmap.dev/~gitbook/mcp).

# Reverse Proxy And HTTPS

Reverse proxies must preserve:

* `Host`
* `X-Forwarded-For`
* `X-Forwarded-Proto`
* `Upgrade`
* `Connection`
* `X-API-Key`

Set production URL variables:

```dotenv
APP_URL=https://netmap.example.com
CORS_ORIGINS=["https://netmap.example.com"]
TRUSTED_HOSTS=["netmap.example.com"]
```

With an `https://` `APP_URL`, sign-in cookies are marked `Secure` automatically. Set `AUTH_COOKIE_SECURE` only to override that; NetMap logs a warning at startup if it is `false` while `APP_URL` uses HTTPS.

HSTS is opt-in. Set `SECURE_HSTS_ENABLED=true` once NetMap will only ever be served over HTTPS on this hostname and the proxy forwards the original protocol correctly. Browsers then refuse plain HTTP for that hostname for `SECURE_HSTS_MAX_AGE` seconds (one year by default), and this cannot be withdrawn early. NetMap logs a warning at startup while HSTS is off.

In production, SuperAdmins also see a persistent **Deployment security needs attention** banner on every workspace while HTTPS security settings need attention. It cannot be dismissed and lists the environment flags to enable. The check includes Secure cookies, HSTS, and `SECURE_HEADERS_ENABLED`; ordinary HTTP installations are not asked to enable HTTPS-only settings. Recreate the container after changing its environment.

The banner checks again every 30 seconds and when the browser window regains focus, and disappears once the running configuration is compliant. Missing flags produce warnings rather than preventing an existing installation from starting.

nginx example:

```nginx
server {
    client_max_body_size 256m;
    listen 443 ssl http2;
    server_name netmap.example.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_read_timeout 600s;
    }
}
```

## Caching

The all-in-one image sends `Cache-Control: public, max-age=31536000, immutable` for the hashed files under `/assets/` and `Cache-Control: no-cache` for `index.html` and other app routes, so browsers keep app files for a year but always revalidate the page and pick up a new release. Proxies and CDNs in front of NetMap should honour these headers and must not cache `index.html` or `/api/` responses. Asset file names include a content hash, so `/assets/` needs no purge after an upgrade.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.netmap.dev/install-and-upgrade/reverse-proxy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
