Overview
RDSWeb Custom is configured via environment variables defined in a.env file in the backend directory. All configuration is loaded through backend/src/config.js which reads from environment variables with sensible defaults.
Copy
backend/.env.example to backend/.env and customize for your environment.Server Configuration
These variables control the Express server settings.The TCP port the backend API server listens on.Example:
In production with a reverse proxy, keep this on localhost-only port. The reverse proxy will handle public HTTPS traffic.
The Node.js environment mode. Set to
production for production deployments.Allowed values:development- Enables debug features and verbose loggingproduction- Optimizes performance and disables debug output
JWT Configuration
JSON Web Tokens (JWT) are used for session authentication after successful LDAP login.The secret key used to sign and verify JWT tokens. This must be changed in production.Example:Generate a secure secret:
The duration a JWT token remains valid before users must re-authenticate.Format: Use time notation like Common values:
1h, 30m, 7d, etc.Example:1h- 1 hour (high security environments)8h- 8 hours (standard work day)24h- 24 hours (convenience)7d- 7 days (not recommended for production)
Active Directory / LDAP Configuration
These settings configure authentication against Active Directory via LDAP.The LDAP or LDAPS URL of your Domain Controller.Format:
ldap://hostname:389- Plain LDAP (not recommended for production)ldaps://hostname:636- LDAP over SSL/TLS (recommended)
The base Distinguished Name (DN) for LDAP searches in your Active Directory domain.Format:
DC=domain,DC=tldExamples:This should match your Active Directory domain structure. For domain
company.local, use DC=company,DC=local.The NetBIOS domain name (short domain name) prepended to usernames during authentication.Format:
DOMAIN\usernameExamples:This is the short domain name users see at Windows login (e.g.,
COMPANY\jdoe). You can find it in Active Directory Domains and Trusts.The service account used for LDAP queries to retrieve user information and group memberships.Formats:Permissions Required:
- UPN format:
[email protected](recommended) - DN format:
CN=svc-rdsweb,OU=Service Accounts,DC=company,DC=local
- Read access to user and group objects in Active Directory
- No administrative privileges needed
The password for the AD service account.Example:
RD Connection Broker Configuration
These settings configure connectivity to the Remote Desktop Connection Broker.The hostname or FQDN of the RD Connection Broker server.Examples:Requirements:
- The backend server must have network access to this server
- WMI access must be enabled (for querying published applications)
- Hostname must be resolvable via DNS
The backend queries this server via PowerShell/WMI to retrieve the list of published RemoteApps available to users. See
backend/src/services/rdcbService.js:85-94 for implementation details.RD Gateway Configuration
Optional configuration for Remote Desktop Gateway.The hostname of the RD Gateway server to include in generated RDP files.Examples:When to use:
- Users connect from outside the corporate network
- You want to tunnel RDP connections through HTTPS (port 443)
- You need additional security and authentication layers
If configured, the generated RDP files will include
gatewayhostname:s:{RDGATEWAY_HOSTNAME} to route connections through the RD Gateway.Simulation Mode
Simulation mode allows testing the application without real Active Directory or RD Connection Broker infrastructure.Enable or disable simulation mode. When What gets simulated:
true, the application uses mock data instead of real AD/RDCB queries.Values:true- Enable simulation mode (for development/testing)false- Use real AD and RD Connection Broker (production)
- Authentication (accepts any username/password)
- LDAP queries (returns mock user data)
- RemoteApp list (returns hardcoded applications)
The default username returned in simulation mode.Example:
Only used when
SIMULATION_MODE=true. This is the username shown after simulated login.The default password accepted in simulation mode.Example:
Only used when
SIMULATION_MODE=true. Any username/password combination will be accepted, but this is the suggested credential.Frontend Configuration
The Angular frontend has its own configuration infrontend/src/environments/.
Development Environment
File:frontend/src/environments/environment.ts
frontend/proxy.conf.json
Production Environment
File:frontend/src/environments/environment.prod.ts
CORS Configuration
CORS (Cross-Origin Resource Sharing) is configured inbackend/src/index.js:19-26.
Default configuration:
origin array to include your production domain:
Example Production Configuration
Here’s a complete example.env file for production:
.env
Configuration Loading
The application loads configuration using the following priority:- Environment variables - Highest priority
.envfile - Loaded viadotenvpackage- Default values - Defined in
backend/src/config.js
backend/src/config.js:1):
Verifying Configuration
Test your configuration with the health check endpoint:simulationModeisfalsein productionrdcbServermatches yourRDCB_SERVERsettingstatusis"ok"
Security Best Practices
Protect Sensitive Variables
Protect Sensitive Variables
- Never commit
.envto version control (add to.gitignore) - Use secrets management (Azure Key Vault, AWS Secrets Manager, HashiCorp Vault)
- Rotate
AD_SERVICE_PASSandJWT_SECRETregularly - Use environment-specific configurations (dev, staging, prod)
Use Secure Protocols
Use Secure Protocols
- Always use LDAPS (
ldaps://) in production - Enable HTTPS on the frontend (via reverse proxy)
- Use TLS 1.2+ for all encrypted connections
- Disable insecure ciphers and protocols
Principle of Least Privilege
Principle of Least Privilege
- Service account should have read-only AD access
- Don’t use domain admin or privileged accounts
- Limit network access to required ports only
- Run backend service as non-root/non-admin user
Monitor and Audit
Monitor and Audit
- Enable application logging
- Monitor failed login attempts
- Set up alerts for configuration changes
- Review AD service account activity regularly
Troubleshooting
Authentication Failures
Authentication Failures
Symptoms: Users cannot log in, LDAP errors in logsCheck:
LDAP_URLis correct and reachable (test withldp.exeorldapsearch)AD_SERVICE_USERandAD_SERVICE_PASSare correctLDAP_BASE_DNmatches your domain structure- Firewall allows LDAP/LDAPS traffic (ports 389/636)
- Service account is not locked or expired
No RemoteApps Appearing
No RemoteApps Appearing
Symptoms: User logs in successfully but no applications are shownCheck:
RDCB_SERVERis correct and reachable- Backend server can query WMI on the RD Connection Broker
- Published RemoteApps exist and are available to the user
- Check backend logs for PowerShell/WMI errors
- Verify simulation mode is disabled (
SIMULATION_MODE=false)
CORS Errors in Browser
CORS Errors in Browser
Symptoms: API requests fail with CORS errors in browser consoleCheck:
- Frontend
apiUrlmatches the backend URL - CORS
origininbackend/src/index.jsincludes your frontend domain credentials: trueis set in CORS configuration- Reverse proxy is forwarding headers correctly
JWT Token Issues
JWT Token Issues
Symptoms: Users logged out unexpectedly, “invalid token” errorsCheck:
JWT_SECRETis consistent across backend restartsJWT_EXPIRES_INis not too short- System clock is synchronized (JWT expiry is time-based)
- Cookies are enabled in the browser
Related Resources
System Requirements
Infrastructure prerequisites and compatibility
Installation Guide
Step-by-step deployment instructions
Quick Start Guide
Set up local development environment
API Reference
Backend API endpoints documentation