Added proxy template for support proxy request from nginx to another service
This commit is contained in:
@@ -83,6 +83,7 @@ if (empty($v_nginx_cache_duration)) {
|
||||
$v_proxy = $data[$v_domain]["PROXY"];
|
||||
$v_proxy_template = $data[$v_domain]["PROXY"];
|
||||
$v_proxy_ext = str_replace(",", ", ", $data[$v_domain]["PROXY_EXT"]);
|
||||
$v_proxy_port = $data[$v_domain]["PROXY_PORT_INTERNAL"];
|
||||
$v_stats = $data[$v_domain]["STATS"];
|
||||
$v_stats_user = $data[$v_domain]["STATS_USER"];
|
||||
$v_stats_password = "";
|
||||
@@ -422,6 +423,9 @@ if (!empty($_POST["save"])) {
|
||||
if (!empty($_POST["v_proxy_template"])) {
|
||||
$v_proxy_template = $_POST["v_proxy_template"];
|
||||
}
|
||||
if (!empty($_POST["v_proxy_port"])) {
|
||||
$v_proxy_port = $_POST["v_proxy_port"];
|
||||
}
|
||||
exec(
|
||||
HESTIA_CMD .
|
||||
"v-change-web-domain-proxy-tpl " .
|
||||
@@ -432,7 +436,9 @@ if (!empty($_POST["save"])) {
|
||||
quoteshellarg($v_proxy_template) .
|
||||
" " .
|
||||
quoteshellarg($ext) .
|
||||
" 'no'",
|
||||
" 'no'" .
|
||||
" " .
|
||||
quoteshellarg($v_proxy_port),
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
@@ -459,6 +465,9 @@ if (!empty($_POST["save"])) {
|
||||
$ext = str_replace(" ", ",", $ext);
|
||||
$v_proxy_ext = str_replace(",", ", ", $ext);
|
||||
}
|
||||
if (!empty($_POST["v_proxy_port"])) {
|
||||
$v_proxy_port = $_POST["v_proxy_port"];
|
||||
}
|
||||
exec(
|
||||
HESTIA_CMD .
|
||||
"v-add-web-domain-proxy " .
|
||||
@@ -469,7 +478,9 @@ if (!empty($_POST["save"])) {
|
||||
quoteshellarg($v_proxy_template) .
|
||||
" " .
|
||||
quoteshellarg($ext) .
|
||||
" 'no'",
|
||||
" 'no'" .
|
||||
" " .
|
||||
quoteshellarg($v_proxy_port),
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
|
||||
@@ -53,6 +53,7 @@ export default function handleEditWebListeners() {
|
||||
// show "Purge Nginx Cache" button if "caching" selected
|
||||
const proxyTemplateSelect = document.querySelector('.js-proxy-template-select');
|
||||
const clearCacheButton = document.querySelector('.js-clear-cache-button');
|
||||
const proxyConnect = document.querySelector('.js-proxy-connect')
|
||||
if (proxyTemplateSelect && clearCacheButton) {
|
||||
proxyTemplateSelect.addEventListener('change', () => {
|
||||
// NOTE: Match "caching" and "caching-*" values
|
||||
@@ -63,4 +64,16 @@ export default function handleEditWebListeners() {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (proxyTemplateSelect && proxyConnect) {
|
||||
proxyTemplateSelect.addEventListener('change', () => {
|
||||
if (proxyTemplateSelect.value === "srvproxy") {
|
||||
proxyConnect.style.display = 'block';
|
||||
} else {
|
||||
proxyConnect.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
if (proxyTemplateSelect.value === "srvproxy") {
|
||||
proxyConnect.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,6 +347,19 @@
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="u-mb10 js-proxy-connect" style="<?php
|
||||
if ($v_proxy_template != "srvproxy") {
|
||||
echo "display:none;";
|
||||
} else {
|
||||
echo "display:block;";
|
||||
} ?>">
|
||||
<div>
|
||||
<label for="v_proxy_port" class="form-lable">
|
||||
<?= _("Set port for internal service") ?>
|
||||
</label>
|
||||
<input type="input" name="v_proxy_port" id="v_proxy_port" value="<?= htmlentities($v_proxy_port) ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-mb10">
|
||||
<label for="v_proxy_ext" class="form-label"><?= _("Proxy Extensions") ?></label>
|
||||
<textarea class="form-control" name="v_proxy_ext" id="v_proxy_ext"><?php if (!empty($v_proxy_ext)) { echo htmlentities(trim($v_proxy_ext, "'"));} else { echo 'jpg, jpeg, gif, png, ico, svg, css, zip, tgz, gz, rar, bz2, exe, pdf, doc, xls, ppt, txt, odt, ods, odp, odf, tar, bmp, rtf, js, mp3, avi, mpeg, flv, html, htm'; } ?></textarea>
|
||||
|
||||
Reference in New Issue
Block a user