Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions backend/migrations/20251027193925_add_timeouts_to_proxy_hosts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const migrate_name = 'pass_auth';
const logger = require('../logger').migrate;

/**
* Migrate
*
* @see http://knexjs.org/#Schema
*
* @param {Object} knex
* @param {Promise} Promise
* @returns {Promise}
*/
exports.up = function (knex/*, Promise*/) {
logger.info('[' + migrate_name + '] Migrating Up...');

return knex.schema.table('proxy_host', function (proxy_host) {
proxy_host.integer('proxy_send_timeout').notNull().defaultTo(60);
proxy_host.integer('proxy_read_timeout').notNull().defaultTo(60);
proxy_host.integer('proxy_connect_timeout').notNull().defaultTo(60);
})
.then(() => {
logger.info('[' + migrate_name + '] proxy_host Table altered');
});
};

/**
* Undo Migrate
*
* @param {Object} knex
* @param {Promise} Promise
* @returns {Promise}
*/
exports.down = function (knex/*, Promise*/) {
logger.info('[' + migrate_name + '] Migrating Down...');

return knex.schema.table('proxy_host', function (proxy_host) {
proxy_host.dropColumn('proxy_send_timeout');
proxy_host.dropColumn('proxy_read_timeout');
proxy_host.dropColumn('proxy_connect_timeout');
})
.then(() => {
logger.info('[' + migrate_name + '] proxy_host proxy_send_timeout, proxy_read_timeout, proxy_connect_timeout Columns dropped');
});
};
37 changes: 33 additions & 4 deletions backend/schema/components/proxy-host-object.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"caching_enabled",
"block_exploits",
"advanced_config",
"proxy_send_timeout",
"proxy_read_timeout",
"proxy_connect_timeout",
"meta",
"allow_websocket_upgrade",
"http2_support",
Expand Down Expand Up @@ -69,6 +72,21 @@
"advanced_config": {
"type": "string"
},
"proxy_send_timeout": {
"description": "Proxy Send Timeout",
"type": "integer",
"minimum": 0
},
"proxy_read_timeout": {
"description": "Proxy Read Timeout",
"type": "integer",
"minimum": 0
},
"proxy_connect_timeout": {
"description": "Proxy Connect Timeout",
"type": "integer",
"minimum": 0
},
"meta": {
"type": "object"
},
Expand All @@ -82,7 +100,10 @@
},
"forward_scheme": {
"type": "string",
"enum": ["http", "https"]
"enum": [
"http",
"https"
]
},
"enabled": {
"$ref": "../common.json#/properties/enabled"
Expand All @@ -92,11 +113,19 @@
"minItems": 0,
"items": {
"type": "object",
"required": ["forward_scheme", "forward_host", "forward_port", "path"],
"required": [
"forward_scheme",
"forward_host",
"forward_port",
"path"
],
"additionalProperties": false,
"properties": {
"id": {
"type": ["integer", "null"]
"type": [
"integer",
"null"
]
},
"path": {
"type": "string",
Expand Down Expand Up @@ -150,4 +179,4 @@
]
}
}
}
}
27 changes: 22 additions & 5 deletions backend/schema/paths/nginx/proxy-hosts/hostID/put.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"operationId": "updateProxyHost",
"summary": "Update a Proxy Host",
"tags": ["Proxy Hosts"],
"tags": [
"Proxy Hosts"
],
"security": [
{
"BearerAuth": ["proxy_hosts"]
"BearerAuth": [
"proxy_hosts"
]
}
],
"parameters": [
Expand Down Expand Up @@ -71,6 +75,15 @@
"advanced_config": {
"$ref": "../../../../components/proxy-host-object.json#/properties/advanced_config"
},
"proxy_send_timeout": {
"$ref": "../../../../components/proxy-host-object.json#/properties/proxy_send_timeout"
},
"proxy_read_timeout": {
"$ref": "../../../../components/proxy-host-object.json#/properties/proxy_read_timeout"
},
"proxy_connect_timeout": {
"$ref": "../../../../components/proxy-host-object.json#/properties/proxy_connect_timeout"
},
"enabled": {
"$ref": "../../../../components/proxy-host-object.json#/properties/enabled"
},
Expand All @@ -97,7 +110,9 @@
"created_on": "2024-10-08T23:23:03.000Z",
"modified_on": "2024-10-08T23:26:37.000Z",
"owner_user_id": 1,
"domain_names": ["test.example.com"],
"domain_names": [
"test.example.com"
],
"forward_host": "192.168.0.10",
"forward_port": 8989,
"access_list_id": 0,
Expand Down Expand Up @@ -126,7 +141,9 @@
"name": "Administrator",
"nickname": "some guy",
"avatar": "//www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?default=mm",
"roles": ["admin"]
"roles": [
"admin"
]
},
"certificate": null,
"access_list": null
Expand All @@ -140,4 +157,4 @@
}
}
}
}
}
34 changes: 28 additions & 6 deletions backend/schema/paths/nginx/proxy-hosts/post.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"operationId": "createProxyHost",
"summary": "Create a Proxy Host",
"tags": ["Proxy Hosts"],
"tags": [
"Proxy Hosts"
],
"security": [
{
"BearerAuth": ["proxy_hosts"]
"BearerAuth": [
"proxy_hosts"
]
}
],
"requestBody": {
Expand All @@ -15,7 +19,12 @@
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["domain_names", "forward_scheme", "forward_host", "forward_port"],
"required": [
"domain_names",
"forward_scheme",
"forward_host",
"forward_port"
],
"properties": {
"domain_names": {
"$ref": "../../../components/proxy-host-object.json#/properties/domain_names"
Expand Down Expand Up @@ -59,6 +68,15 @@
"advanced_config": {
"$ref": "../../../components/proxy-host-object.json#/properties/advanced_config"
},
"proxy_send_timeout": {
"$ref": "../../../components/proxy-host-object.json#/properties/proxy_send_timeout"
},
"proxy_read_timeout": {
"$ref": "../../../components/proxy-host-object.json#/properties/proxy_read_timeout"
},
"proxy_connect_timeout": {
"$ref": "../../../components/proxy-host-object.json#/properties/proxy_connect_timeout"
},
"enabled": {
"$ref": "../../../components/proxy-host-object.json#/properties/enabled"
},
Expand All @@ -85,7 +103,9 @@
"created_on": "2024-10-08T23:23:03.000Z",
"modified_on": "2024-10-08T23:23:03.000Z",
"owner_user_id": 1,
"domain_names": ["test.example.com"],
"domain_names": [
"test.example.com"
],
"forward_host": "127.0.0.1",
"forward_port": 8989,
"access_list_id": 0,
Expand All @@ -112,7 +132,9 @@
"name": "Administrator",
"nickname": "some guy",
"avatar": "//www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?default=mm",
"roles": ["admin"]
"roles": [
"admin"
]
},
"access_list": null
}
Expand All @@ -125,4 +147,4 @@
}
}
}
}
}
4 changes: 4 additions & 0 deletions backend/templates/proxy_host.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ proxy_http_version 1.1;
access_log /data/logs/proxy-host-{{ id }}_access.log proxy;
error_log /data/logs/proxy-host-{{ id }}_error.log warn;

proxy_send_timeout {{ proxy_send_timeout }};
proxy_read_timeout {{ proxy_read_timeout }};
proxy_connect_timeout {{ proxy_connect_timeout }};

{{ advanced_config }}

{{ locations }}
Expand Down
Loading