fix(route-connection-handler): Forward non-TLS connections on HttpProxy ports to fix ACME HTTP-01 challenge handling
This commit is contained in:
@ -91,4 +91,45 @@ const proxy = new SmartProxy({
|
||||
- Update `plugins.ts` when adding new dependencies.
|
||||
- Maintain test coverage for new routing or proxy features.
|
||||
- Keep `ts/` and `dist_ts/` in sync after refactors.
|
||||
- Consider implementing top-level ACME config support for backward compatibility
|
||||
- Consider implementing top-level ACME config support for backward compatibility
|
||||
|
||||
## HTTP-01 ACME Challenge Fix (v19.3.8)
|
||||
|
||||
### Issue
|
||||
Non-TLS connections on ports configured in `useHttpProxy` were not being forwarded to HttpProxy. This caused ACME HTTP-01 challenges to fail when the ACME port (usually 80) was included in `useHttpProxy`.
|
||||
|
||||
### Root Cause
|
||||
In the `RouteConnectionHandler.handleForwardAction` method, only connections with TLS settings (mode: 'terminate' or 'terminate-and-reencrypt') were being forwarded to HttpProxy. Non-TLS connections were always handled as direct connections, even when the port was configured for HttpProxy.
|
||||
|
||||
### Solution
|
||||
Added a check for non-TLS connections on ports listed in `useHttpProxy`:
|
||||
```typescript
|
||||
// No TLS settings - check if this port should use HttpProxy
|
||||
const isHttpProxyPort = this.settings.useHttpProxy?.includes(record.localPort);
|
||||
|
||||
if (isHttpProxyPort && this.httpProxyBridge.getHttpProxy()) {
|
||||
// Forward non-TLS connections to HttpProxy if configured
|
||||
this.httpProxyBridge.forwardToHttpProxy(/*...*/);
|
||||
return;
|
||||
}
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
- `test/test.http-fix-unit.ts` - Unit tests verifying the fix
|
||||
- Tests confirm that non-TLS connections on HttpProxy ports are properly forwarded
|
||||
- Tests verify that non-HttpProxy ports still use direct connections
|
||||
|
||||
### Configuration Example
|
||||
```typescript
|
||||
const proxy = new SmartProxy({
|
||||
useHttpProxy: [80], // Enable HttpProxy for port 80
|
||||
httpProxyPort: 8443,
|
||||
acme: {
|
||||
email: 'ssl@example.com',
|
||||
port: 80
|
||||
},
|
||||
routes: [
|
||||
// Your routes here
|
||||
]
|
||||
});
|
||||
```
|
Reference in New Issue
Block a user