Self-Hosting External CSS and JavaScript Files
What is Self-Hosting?
Self-hosting automatically downloads external CSS and JavaScript files to your server and serves them locally. This improves page loading performance, privacy, and reliability.
Key Benefits
- Faster loading times: Reduced external HTTP requests
- Enhanced privacy: No external connections required
- Better reliability: Independence from external servers
- Improved caching: Full control over cache headers
- GDPR compliance: Reduced third-party data sharing
How It Works
When self-hosting is enabled, ZiziCache automatically:
- Detects external CSS and JavaScript files
- Downloads them to your server’s cache directory
- Updates HTML references to point to local files
- Serves files from local cache with optimized headers
- Maintains updates when source files change
Configuration
Enable self-hosting in Optimization � General � Host external CSS and JS locally
Automatic Processing Features
- Resource hints cleanup: Removes unnecessary preload/prefetch
- Origin tracking: Tracks original URL in data-origin-src attribute
- Integrity removal: Removes integrity and crossorigin attributes for local files
- Cache management: Intelligent cache invalidation and updates
Security
Downloaded files are stored in a protected directory with:
- Strict file type validation (only .css and .js files allowed)
- PHP execution prevention
- Access logging for security monitoring
- Automatic .htaccess protection
Best Practices
- Monitor disk space usage in admin dashboard
- Regularly clear external file cache if needed
- Test functionality after enabling on staging sites first
- Verify that external resources don’t require dynamic updates