Why Use a Proxy with SCANOSS?
Centralised API Key Management
The proxy automatically injects the SCANOSS API key, eliminating the need to distribute it to developer machines. This ensures secure, centralised control over API access.Security & Access Control
- Enforce corporate policies with centralised traffic monitoring and filtering
- Restrict access to authorised internal systems
- Maintain full visibility into all API interactions
Usage Tracking & Logging
- Monitor scan activity by team or project
- Analyse API usage patterns
- Preserve detailed audit logs for compliance
Network Architecture Requirements
Supports enterprise network policies requiring:- Centralised outbound traffic control
- Internal certificate-based communication
- Deep packet inspection and filtering
Prerequisites
Before you begin, you’ll need:- Caddy: Lightweight reverse proxy that securely injects your SCANOSS API key into outgoing API requests.
- SCANOSS API key: Enables 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. Windows- Create a new folder to store Caddy and its configuration
- Inside that folder, create a new file named
Caddyfile - Add the following configuration:
- Replace
YOUR_API_KEY_HEREwith your actual SCANOSS API key - Save and Close
- Create a new folder to store Caddy and its configuration
- Inside that folder, create a new file named
Caddyfile - Add the following configuration:
- Replace
YOUR_API_KEY_HEREwith your actual SCANOSS API key - Save and Close
You can change port 1980 to any available port (for example, 8080 or 8888). 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/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 certificates 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 start Caddy: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 start Caddy:Running as a systemd Service (Optional)
Run Caddy as a systemd service to ensure it starts automatically on boot and restarts if it crashes. macOS/Linux- Create a systemd service file:
- Add the following configuration:
Update/etc/caddy/Caddyfileto match the actual path to your Caddyfile. 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 if it crashes. Windows- 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 your Caddyfile.
- Configure the service (optional):
- Start the service:
- Verify the service is running:
services.msc) to manage the service through the GUI.
Stopping Caddy
Use Caddy with SBOM Workbench
By using Caddy as a local proxy, SBOM Workbench can connect to the ScanOSS API without storing your API key in the application.- Open SBOM Workbench
- Go to File → Settings → ”+”
-
For API URL, enter:
For HTTP connections, use
http://localhost:1980if running locally. For HTTPS connections, usehttps://localhost:1980orhttps://<your-domain> - Click Add → Save
- Select the API connection you just added when scanning a project
Use Caddy with SCANOSS-PY
Once your Caddy proxy is running, SCANOSS-PY can be used without supplying an API key. All requests go through Caddy, which injects the key automatically.Troubleshooting
Port conflicts
If Caddy fails to start it usually means the default admin API port is already in use. You can fix this by disabling the admin API in yourCaddyfile:
Place this at the top of your Caddyfile before any site definitions.