Skip to content

fix: use correct URL scheme when SSL is configured#2819

Merged
hayescode merged 1 commit intoChainlit:mainfrom
Br1an67:fix/issue-1766-https-dev-server
Mar 5, 2026
Merged

fix: use correct URL scheme when SSL is configured#2819
hayescode merged 1 commit intoChainlit:mainfrom
Br1an67:fix/issue-1766-https-dev-server

Conversation

@Br1an67
Copy link
Contributor

@Br1an67 Br1an67 commented Mar 1, 2026

What

Fix the startup URL to use https:// when SSL certificates are configured, and make the frontend dev server URL configurable.

Closes #1766

Why

The startup message always shows http:// even when --ssl-cert and --ssl-key are provided. The frontend also hardcodes http://localhost:8000 for dev mode, preventing HTTPS development.

Changes

  • backend/chainlit/server.py: Detect config.run.ssl_cert to choose https or http scheme in startup URL
  • frontend/src/api/index.ts: Use VITE_API_URL env var (falling back to http://localhost:8000) for configurable dev server URL

Usage

# Backend
chainlit run app.py --ssl-cert cert.pem --ssl-key key.pem
# Now shows: Your app is available at https://localhost:8000

# Frontend dev with HTTPS backend
VITE_API_URL=https://localhost:8000 pnpm dev

Testing

Without SSL: behavior unchanged. With SSL: correct https:// URL displayed.


Summary by cubic

Fixes the startup URL to use https when SSL certs are provided and makes the frontend dev API URL configurable. This enables HTTPS development and avoids misleading http links.

  • Bug Fixes

    • Backend now picks http/https for the startup message based on ssl_cert.
  • New Features

Written for commit 0793b5f. Summary will update on new commits.

Detect SSL configuration to display correct URL in startup message.
Make frontend dev server URL configurable via VITE_API_URL env var.
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. backend Pertains to the Python backend. frontend Pertains to the frontend. labels Mar 1, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@hayescode hayescode added this pull request to the merge queue Mar 5, 2026
Merged via the queue into Chainlit:main with commit f231827 Mar 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. frontend Pertains to the frontend. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTPS support for dev server

2 participants