- HTTP/HTTPS Proxies: Route traffic through corporate proxy servers
- gRPC Proxies: Dedicated proxy support for gRPC API calls
- PAC (Proxy Auto-Config): Automatic proxy discovery and configuration
- Custom SSL Certificates: Use organisation-specific CA certificates
- Certificate Validation Control: Disable certificate validation in testing environments
- Reverse Proxy with API Key Injection: Centralised API key management for enterprise deployments
HTTP/HTTPS Proxy Configuration
CLI Option
Use the--proxy flag to specify a proxy server:
Environment Variables
Set proxy environment variables for automatic detection:Reverse Proxy with API Key Injection
A reverse proxy acts as an intermediary between your application and the SCANOSS API server, automatically injecting your API key into requests.Why Use a Reverse Proxy?
Centralised API Key Management The proxy automatically injects the SCANOSS API key, removing the need to distribute it to individual developer machines. This provides centralised control over API access. Security and Access Control- Enforce corporate policies with centralised traffic monitoring and filtering
- Restrict access to authorised internal systems
- Maintain full visibility into all API interactions
- Monitor scan activity by team or project
- Analyse API usage patterns
- Preserve detailed audit logs for compliance
- Centralised outbound traffic control
- Internal certificate-based communication
- Deep packet inspection and filtering
Prerequisites
Before you begin, you will need:- Caddy: A reverse proxy that injects your SCANOSS API key into outgoing API requests
- SCANOSS API key: Required for access to SCANOSS enterprise features
Proxy Configuration
Follow the steps below to configure Caddy as a reverse proxy that injects your SCANOSS API key into outgoing requests. TheCaddyfile configuration is the same on all platforms. Create a folder to store Caddy and its
configuration, then create a file named Caddyfile inside it with the following content:
YOUR_API_KEY_HERE with your actual SCANOSS API key and save the file.
You can change port1980to any available port (for example,8080or8888). Ensure the chosen port is not already in use by another service.
HTTPS Configuration
Automatic HTTPS with a Domain
If you have a domain name, Caddy can automatically obtain and renew SSL certificates:proxy.example.com with your actual domain. Caddy will automatically:
- Obtain a Let’s Encrypt certificate
- Handle HTTPS on port 443
- Redirect HTTP to HTTPS
Self-Signed Certificate for Internal Use
For internal or local deployments without a domain, use a self-signed certificate:Self-signed certificates will trigger security warnings in browsers and applications. You may need to add the certificate to your system’s trusted certificate store, or configure your tools to accept self-signed certificates.
Custom Certificate Files
If you have your own certificate and key files:https:// instead of http://.
Running Caddy
Once theCaddyfile is configured, you can start the proxy in either interactive or background mode.
Interactive Mode
Run Caddy in the foreground to verify your configuration and observe logs in real time. Windows Open PowerShell, navigate to the folder, and run:Background Mode
Run Caddy as a background process so it continues running after you close the terminal. Windows Open PowerShell, navigate to the folder, and run:Running as a systemd Service (Linux only)
Run Caddy as a systemd service to ensure it starts automatically on boot and restarts on failure.- Create a systemd service file:
- Add the following configuration:
Update/etc/caddy/Caddyfileto match the actual path to yourCaddyfile. Update/usr/bin/caddyif Caddy is installed in a different location (check withwhich caddy).
- Enable and start the service:
- Check the service status:
Running as a Windows Service (Optional)
Run Caddy as a Windows service to ensure it starts automatically on boot and restarts on failure.- Download and install NSSM
- Open PowerShell as Administrator and navigate to the NSSM directory
- Install Caddy as a service:
ReplaceC:\path\to\caddy.exewith the actual path to your Caddy executable. ReplaceC:\path\to\Caddyfilewith the actual path to yourCaddyfile.
- Configure the service (optional):
- Start the service:
- Verify the service is running:
services.msc) to manage the service via the GUI.
Stopping Caddy
Using SCANOSS-PY with a Reverse Proxy
Once Caddy is running, SCANOSS-PY can be used without supplying an API key directly. All requests are routed through Caddy, which injects the key automatically.Troubleshooting Caddy
Port Conflicts
If Caddy fails to start, it is usually because the default admin API port is already in use. You can resolve this by disabling the admin API in yourCaddyfile:
Place this block at the top of your Caddyfile, before any site definitions.
Stopping Existing Caddy Instances
If the conflict persists, check for running Caddy processes and stop them: WindowsgRPC Proxy Configuration
For gRPC API calls, use the dedicated--grpc-proxy option.
CLI Option
Environment Variable
PAC (Proxy Auto-Config)
SCANOSS supports automatic proxy configuration using PAC files.What is PAC?
PAC (Proxy Auto-Config) files contain JavaScript functions that automatically determine the correct proxy server for each URL. Organisations use PAC files for dynamic proxy configuration across varied network environments.Enable PAC Auto-Discovery
Specify a PAC File
Test PAC Configuration
Use thepac-proxy utility to test your PAC configuration:
Custom SSL Certificates
Configure custom CA certificates for organisations using internal certificate authorities.CLI Option
Environment Variables
For the HTTP/REST API (requests library):
Find the System Certificate Location
Use thecertloc utility to find your system’s CA certificate location:
Download Server Certificates
SCANOSS provides a utility to download SSL certificates from servers:Certificate Validation for HTTPS Proxies
When using HTTPS connections with self-signed certificates (common in internal proxy deployments), you may need to handle certificate validation explicitly. Using Custom Certificates with a Reverse Proxy Provide your proxy’s certificate using the--ca-cert option:
- Add the certificate to your system’s trusted certificate store
- Configure SCANOSS-PY to accept the certificate using
--ca-cert - Set the
REQUESTS_CA_BUNDLEenvironment variable
Security Note: Only disable certificate verification in trusted, controlled environments. Always use valid certificates issued by a recognised CA in production.