This document outlines security best practices and configurations for the Ollama WebUI application.
Create a .env file in the root directory with the following secure configurations:
# Ollama Configuration
OLLAMA_BASE_URL=http://localhost:11434
# Model Configuration
DEFAULT_MODEL=llama3.2:3b
DEFAULT_TEMPERATURE=0.5
DEFAULT_TIMEOUT=30
# Application Security
DEBUG=False
ALLOWED_HOSTS=localhost,127.0.0.1
CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
# Server Configuration
GUNICORN_PORT=8000
GUNICORN_WORKERS=1
# Frontend Configuration
VITE_SERVER_BASE_URL=http://localhost- Never commit .env files to version control
- Use specific hostnames instead of wildcards (*)
- Set DEBUG=False in production
- Limit CORS origins to trusted domains only
- Use HTTPS in production
- Regularly update dependencies
- Use environment-specific configuration files
- Implement proper authentication if exposing to public networks
- Use reverse proxy (nginx) with proper security headers
- Enable rate limiting to prevent abuse
- Monitor and log security events
- Use HTTPS with proper SSL certificates
- CORS Misconfiguration: Never use
allow_origins=["*"]in production - Debug Mode: Ensure DEBUG is False in production
- Error Disclosure: Avoid exposing detailed system information in error messages
- Input Validation: Always validate and sanitize user inputs
- Dependency Vulnerabilities: Regularly update dependencies
If you discover a security vulnerability, please report it privately by:
- Creating a private GitHub security advisory
- Contacting the maintainers directly
Do not create public issues for security vulnerabilities.