What is a Proxy?
A proxy is a server that acts as an intermediary between your application and another server. In the context of SCANOSS, a reverse proxy sits between your tools and the SCANOSS API, forwarding requests on your behalf.Why Use a Proxy with SCANOSS?
Centralised API Key Management
The proxy automatically injects the SCANOSS API key into outgoing requests, eliminating the need to distribute it to individual developer machines. This ensures 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 will need:- Caddy: A reverse proxy server used to inject your SCANOSS API key into outgoing API requests.
- SCANOSS API key: Required to authenticate requests to the SCANOSS API.
Basic Proxy Configuration
Follow the steps below to configure Caddy as a reverse proxy that injects your SCANOSS API key into outgoing requests. Windows / macOS / Linux- 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. If you do not yet have a key, refer to the Prerequisites section above. - Save and close the file.
You can change port1980to any available port (e.g.8080or8888).
Ensure the chosen port is not already in use by another service.
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. WindowsBackground Mode
Run Caddy as a background process so it continues running after you close the terminal. WindowsStopping Caddy
Running as a systemd Service (Linux only)
Note: systemd is a Linux-specific init system and is not available on macOS by
default. macOS users should use launchd or run Caddy in background mode instead.
Run Caddy as a systemd service to ensure it starts automatically on boot and restarts
if it crashes.
- 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 (verify withwhich caddy).
- Enable and start the service:
- Check the service status:
Running as a Windows Service
Run Caddy as a Windows service to ensure it starts automatically on boot and restarts if it crashes.- Download and install NSSM (Non-Sucking Service Manager).
- Open PowerShell as Administrator and change directory to the folder where NSSM is installed.
- 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).
Troubleshooting
Port Conflicts
If Caddy fails to start, Caddy’s built-in admin API (which listens on a separate port by default) may be conflicting with another process. Disable the admin API by adding the following global block at the top of yourCaddyfile, before any site definitions: