Resolving Composer Multi-Credential Problems in Satis Domainsmo
The blog explains how to manage multiple credentials in Composer with TYPO3 Satis domains, using subdomains to handle different vendor credentials and streamline the workflow.
Problem Overview
In real-world TYPO3 projects, developers often manage premium extensions from various vendors. Each vendor may require different credentials, leading to conflicts when Composer attempts to authenticate using a single set of credentials per domain. This limitation can result in:
Manual installation of packages
Sharing credentials among team members
Complex workarounds like mixing global and project-specific auth.json files
Forking packages to maintain separate repositories
Proposed Solution: Multi-Domain Setup
The proposed solution involves creating multiple subdomains, each serving the same repository content but requiring different authentication credentials. This approach leverages Composer's single-credential-per-domain limitation by assigning unique credentials to each subdomain.
Architecture Overview
composer.t3planet.cloud → Vendor A credentials
composer2.t3planet.cloud → Vendor B credentials
composer3.t3planet.cloud → Vendor C credentials
composer4.t3planet.cloud → Vendor D credentials
Each subdomain serves identical package content but requires different authentication, allowing seamless use of multiple credential sets.
Technical Implementation
The core challenge is dynamically rewriting URLs in the packages.json file to reflect the requesting subdomain. Satis generates static JSON files with hardcoded URLs pointing to the primary domain. To address this, a high-performance caching proxy with streaming URL replacement is implemented to handle large JSON files efficiently.
Steps for Implementation
Domain Setup: Create multiple subdomains pointing to the same Satis installation.
Authentication Configuration: Configure different authentication for each subdomain using .htaccess files.
Deploy Processing Engine: Upload the handler.php and .htaccess files to enable dynamic URL rewriting.
Cache Management: Implement cache management scripts to view, clear, or clean the cache as needed.
Monitoring and Maintenance: Set up cron jobs for daily cache cleanup and weekly cache regeneration.
Debug Mode: Enable debug headers for troubleshooting.
Comparison with Other Solutions
Multiple Satis Instances
Setup Complexity: High
Maintenance: High
Performance: High
Credential Limit: Unlimited
Cost: High
Proxy Repositories
Setup Complexity: Medium
Maintenance: Medium
Performance: Medium
Credential Limit: Limited
Cost: Medium
Manual Management
Setup Complexity: Low
Maintenance: Very High
Performance: Poor
Credential Limit: Limited
Cost: Low
The multi-domain approach offers a balanced solution with medium setup complexity, low maintenance, excellent performance, unlimited credential support, and low cost.
Future Considerations
The solution is designed to be:
Vendor-Agnostic: Works with any Satis-based repository.
Framework-Independent: Not tied to specific TYPO3 or PHP versions.
Scalable: Easily add more domains as needed.
Maintainable: Clean, documented code with comprehensive error handling.
Standard-Compliant: Uses standard Apache/PHP features.
Common Issues and Solutions
403 Forbidden Errors: Ensure correct file permissions and .htaccess syntax.
Slow First-Time Responses: Expected behavior; subsequent requests will be faster.
Cache Not Updating: Run php cache_manager.php clear to refresh the cache.
CLI Tools Failing: Verify URL encoding support is working.
Conclusion
Managing multiple credentials in Composer can be streamlined using a multi-domain setup with dynamic URL rewriting. This approach eliminates credential conflicts, maintains performance, simplifies management, scales effortlessly, and reduces maintenance overhead. It has been successfully implemented in production environments, serving hundreds of developers and thousands of package downloads daily.













