Feature/https domain support#105
Open
somethingwentwell wants to merge 4 commits intodataelement:mainfrom
Open
Conversation
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automated production HTTPS support (Nginx TLS + Certbot) and introduces domain-based public URL configuration used by the backend (redirect + webhook URL generation).
Changes:
- Introduces Nginx SSL runtime templating + startup logic, plus a Certbot container for issuance/renewal.
- Adds backend
DOMAINsetting, HTTPS redirect middleware, andpublic_base_urlfor constructing external callback URLs. - Makes frontend build versioning more robust when
VERSIONis missing in some container build contexts.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/vite.config.ts | Falls back to a default version if ../VERSION isn’t available during builds. |
| frontend/nginx.ssl.conf.template | New SSL-enabled Nginx config template (80→443 redirect + ACME webroot + proxying). |
| frontend/entrypoint-nginx.sh | New entrypoint to select SSL vs HTTP config, create temporary certs, and reload on renewal. |
| frontend/Dockerfile | Installs OpenSSL and switches to custom entrypoint; exposes 80/443. |
| docker-compose.yml | Adds certbot service + shared volumes; publishes 443; passes DOMAIN/ENABLE_SSL to frontend. |
| certbot-entrypoint.sh | New certbot issuance + renewal loop with nginx reload signaling. |
| backend/app/main.py | Adds HTTPS redirect middleware based on DOMAIN and proxy headers. |
| backend/app/config.py | Adds DOMAIN and public_base_url helper property. |
| backend/app/api/feishu.py | Updates webhook URL construction priority to use config/env before request base URL. |
| .env.example | Documents new domain + SSL-related environment variables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces automated HTTPS support for production deployments, including Let's Encrypt certificate management, HTTP-to-HTTPS redirection, and environment-based configuration for public URLs. The changes affect both the backend and frontend, making it easy to deploy the app securely with minimal manual setup. The most important changes are grouped below.
HTTPS and Domain Configuration:
DOMAINenvironment variable and enabling HTTPS redirection and certificate management viaENABLE_SSLandLETSENCRYPT_EMAILin.env.example. (.env.example, .env.exampleR8-R15)DOMAINsetting and apublic_base_urlproperty that constructs the public base URL from environment variables or falls back to the domain. (backend/app/config.py, [1] [2]backend/app/api/feishu.py, backend/app/api/feishu.pyR130-R141)Backend HTTPS Redirection:
HTTPSRedirectMiddlewareto the backend, which automatically redirects HTTP requests to HTTPS whenDOMAINis set, using theX-Forwarded-Protoheader for proxy awareness. (backend/app/main.py, [1] [2] [3]Frontend HTTPS and Certificate Management:
entrypoint-nginx.sh) that generates a self-signed certificate if needed, uses a template for SSL-enabled Nginx configuration, and reloads Nginx when certificates are renewed. (frontend/entrypoint-nginx.sh, frontend/entrypoint-nginx.shR1-R36)nginx.ssl.conf.template) for dynamic domain substitution and correct proxying of API and websocket requests. (frontend/nginx.ssl.conf.template, frontend/nginx.ssl.conf.templateR1-R56)frontend/Dockerfile, frontend/DockerfileR9-R16)Let's Encrypt Automation:
certbot-entrypoint.sh, certbot-entrypoint.shR1-R42)docker-compose.ymlto add acertbotservice, connect it to the frontend via shared volumes for certificates, and set up necessary environment variables and ports for HTTPS. (docker-compose.yml, docker-compose.ymlR65-R96)Build Robustness:
VERSIONfiles in Docker builds, avoiding build failures. (frontend/vite.config.ts, frontend/vite.config.tsL6-R12)Checklist