[GH-ISSUE #272] Document HTTPS support via SERVER_CERT_PATH/SERVER_KEY_PATH #1740

Closed
opened 2026-04-27 19:07:23 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @fabriziosorgente on GitHub (Apr 19, 2026).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/272

Originally assigned to: @arunavo4 on GitHub.

The application supports native HTTPS out of the box through @astrojs/node, but this is not documented in the project.

@astrojs/node v10 reads two environment variables at runtime in standalone.ts:

if (process.env.SERVER_CERT_PATH && process.env.SERVER_KEY_PATH) {
    httpServer = https.createServer({
        key: fs.readFileSync(process.env.SERVER_KEY_PATH),
        cert: fs.readFileSync(process.env.SERVER_CERT_PATH),
    }, listener);
}

When both variables are set, the server starts as a real HTTPS server.

To deploy gitea-mirror in HTTPS, add this to your .env or systemd service:

SERVER_CERT_PATH=/path/to/cert.pem
SERVER_KEY_PATH=/path/to/key.pem
PORT=443
BETTER_AUTH_URL=https://your-domain.com
BETTER_AUTH_TRUSTED_ORIGINS=https://your-domain.com

SERVER_CERT_PATH and SERVER_KEY_PATH are not mentioned in the documentation. I suggest to add a HTTPS section to docs/ENVIRONMENT_VARIABLES.md documenting these two variables.

Originally created by @fabriziosorgente on GitHub (Apr 19, 2026). Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/272 Originally assigned to: @arunavo4 on GitHub. The application supports native HTTPS out of the box through `@astrojs/node`, but this is not documented in the project. `@astrojs/node` v10 reads two environment variables at runtime in [standalone.ts](https://github.com/withastro/astro/blob/refs/tags/@astrojs/node@10.0.1/packages/integrations/node/src/standalone.ts): ```ts if (process.env.SERVER_CERT_PATH && process.env.SERVER_KEY_PATH) { httpServer = https.createServer({ key: fs.readFileSync(process.env.SERVER_KEY_PATH), cert: fs.readFileSync(process.env.SERVER_CERT_PATH), }, listener); } ``` When both variables are set, the server starts as a real HTTPS server. To deploy gitea-mirror in HTTPS, add this to your `.env` or systemd service: ``` SERVER_CERT_PATH=/path/to/cert.pem SERVER_KEY_PATH=/path/to/key.pem PORT=443 BETTER_AUTH_URL=https://your-domain.com BETTER_AUTH_TRUSTED_ORIGINS=https://your-domain.com ``` `SERVER_CERT_PATH` and `SERVER_KEY_PATH` are not mentioned in the documentation. I suggest to add a HTTPS section to `docs/ENVIRONMENT_VARIABLES.md` documenting these two variables.
GiteaMirror added the documentationenhancement labels 2026-04-27 19:07:24 -05:00
Author
Owner

@arunavo4 commented on GitHub (Apr 20, 2026):

Thanks @fabriziosorgente @astrojs/node@10 does read SERVER_CERT_PATH / SERVER_KEY_PATH at runtime, and we're on that version. Documented in 8cb8fd6:

SERVER_CERT_PATH=/etc/ssl/gitea-mirror/cert.pem
SERVER_KEY_PATH=/etc/ssl/gitea-mirror/key.pem

Closing as documented. Thanks for the write-up!

<!-- gh-comment-id:4277726879 --> @arunavo4 commented on GitHub (Apr 20, 2026): Thanks @fabriziosorgente `@astrojs/node@10` does read `SERVER_CERT_PATH` / `SERVER_KEY_PATH` at runtime, and we're on that version. Documented in 8cb8fd6: - Env reference: [HTTPS / TLS section](https://github.com/RayLabsHQ/gitea-mirror/blob/main/docs/ENVIRONMENT_VARIABLES.md#https--tls) - `.env.example` now includes commented examples ```bash SERVER_CERT_PATH=/etc/ssl/gitea-mirror/cert.pem SERVER_KEY_PATH=/etc/ssl/gitea-mirror/key.pem ``` Closing as documented. Thanks for the write-up!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#1740