Rewrite CutOS console host header
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
const configDir = fs.mkdtempSync(path.join(os.tmpdir(), 'clawd-frpc-'));
|
||||
process.env.CLAWD_CONFIG_DIR = configDir;
|
||||
|
||||
const { writeFrpcConfig } = require('../lib/frpc');
|
||||
|
||||
test('dashboard proxy can rewrite Host header for CutOS pi-web', () => {
|
||||
writeFrpcConfig(1045, {
|
||||
auth_token: 'test-token',
|
||||
dashboard_local_port: 30141,
|
||||
dashboard_host_header: '127.0.0.1',
|
||||
}, null, true);
|
||||
|
||||
const toml = fs.readFileSync(path.join(configDir, 'frpc.toml'), 'utf8');
|
||||
assert.match(toml, /localPort = 30141/);
|
||||
assert.match(toml, /subdomain = "1045"/);
|
||||
assert.match(toml, /hostHeaderRewrite = "127\.0\.0\.1"/);
|
||||
});
|
||||
Reference in New Issue
Block a user