Fix: Critical S3 environment variables and subdomain support for video playback - #1
Open
webvijayi wants to merge 3 commits into
Open
Fix: Critical S3 environment variables and subdomain support for video playback#1webvijayi wants to merge 3 commits into
webvijayi wants to merge 3 commits into
Conversation
added 2 commits
November 24, 2025 09:20
Critical fixes for video playback and desktop app uploads: 1. **Missing Environment Variables (Bugfix)** - Added CAP_AWS_ACCESS_KEY and CAP_AWS_SECRET_KEY - Added CAP_AWS_ENDPOINT for internal S3 communication - Added S3_INTERNAL_ENDPOINT and S3_PUBLIC_ENDPOINT - Added AWS SDK compatibility variables (AWS_SDK_LOAD_CONFIG, AWS_EC2_METADATA_DISABLED) - These were causing 'CredentialsProviderError' preventing uploads 2. **S3 Subdomain Support (Enhancement)** - Implemented s3.domain.com subdomain pattern for HTTPS video access - Prevents mixed content errors (HTTPS page loading HTTP videos) - Enables proper SSL/TLS for video playback - Maintains compatibility with desktop app uploads 3. **Smart S3 URL Configuration** - Uses HTTPS subdomain when SSL is enabled (s3.domain.com) - Falls back to direct port when using IP or no SSL (domain:9000) - Supports both custom reverse proxy and built-in nginx setups 4. **Enhanced DNS Instructions** - Added clear instructions for S3 subdomain DNS configuration - Explains why subdomain is required - Notes automatic SSL certificate issuance for subdomain Fixes: - Desktop app uploads now work correctly - Video playback in browser no longer shows 'Unsupported Format' - No more mixed content security errors - Proper S3 credential authentication Tested on DirectAdmin + AlmaLinux 8 with full SSL setup.
Enhanced README with user-friendly explanations of critical fixes: - Added "What's New - Production-Ready v2.0" section explaining: ✅ Desktop app upload fixes (CredentialsProviderError) ✅ Video playback fixes (Unsupported Format error) ✅ Mixed content security fixes - Enhanced "Domain & SSL Setup" section: - Clear visual DNS record examples for copy-paste - S3 subdomain requirement explained in simple terms - "Why You Need the S3 Subdomain" subsection - Updated "Recordings Storage" section: - How video storage works with public URLs - HTTPS subdomain benefits clearly listed - Enhanced "Configuration" section: - New S3 variables marked with ✨ indicators - Explanation of why each variable matters Emphasizes "just works" experience with zero manual configuration.
BREAKING CHANGE: Removed environment variables that Cap doesn't use Removed variables (not used by Cap's source code): - AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY - AWS_SDK_LOAD_CONFIG, AWS_EC2_METADATA_DISABLED - S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY - S3_BUCKET, S3_REGION, S3_ENDPOINT - NEXT_PUBLIC_S3_ENDPOINT Kept only what Cap actually requires: - CAP_AWS_BUCKET, CAP_AWS_REGION (required) - CAP_AWS_ACCESS_KEY, CAP_AWS_SECRET_KEY (required) - CAP_AWS_ENDPOINT (fallback for S3 endpoints) - S3_INTERNAL_ENDPOINT (server-side operations) - S3_PUBLIC_ENDPOINT (CRITICAL for browser/desktop) Documentation updates: - Corrected "Production-Ready v2.0" section - Removed false claims about missing variables - Focused on real value: HTTPS S3 subdomain configuration - Added clear explanations of why each variable matters - Emphasized S3_PUBLIC_ENDPOINT as the critical fix This aligns with Cap's official patterns and makes the installer cleaner, more maintainable, and easier to understand. Verified working on production (AlmaLinux 8).
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.
Problem
The current installer was missing critical environment variables causing Cap uploads to fail with
CredentialsProviderError, and video playback to fail with mixed content errors.Root Causes Discovered
1. Missing Environment Variables Bug
Cap's
Aws.tschecks for specific variable names:CAP_AWS_ACCESS_KEYandCAP_AWS_SECRET_KEYCAP_AWS_ENDPOINTfor S3 endpoint configurationWithout these, Cap fell back to AWS container metadata, causing errors.
2. Mixed Content Security Issue
When using HTTPS for the main site but HTTP for videos (port 9000), browsers block the content:
Solution
Docker Environment Variables
Added all missing variables to
docker-compose.ymlgeneration:S3 Subdomain Pattern
Implements industry-standard S3 subdomain approach:
https://s3.domain.com(no mixed content)http://domain:9000Smart URL Configuration
Enhanced User Guidance
Added clear DNS setup instructions:
Testing
Tested on production server with:
Verified Working:
✅ Desktop app uploads
✅ Video playback in browser
✅ No mixed content errors
✅ Proper S3 authentication
✅ SSL certificate auto-issued for subdomain
Compatibility
References
packages/web-backend/src/Aws.tsFixes issues encountered during self-hosted deployment where uploads and playback both failed.