mirror of https://github.com/Aidaho12/haproxy-wi
parent
08637d37a3
commit
3c76043935
17
app/add.py
17
app/add.py
|
@ -40,6 +40,7 @@ cert_path = config.get('haproxy', 'cert_path')
|
|||
if form.getvalue('mode') is not None:
|
||||
serv = form.getvalue('serv')
|
||||
port = form.getvalue('port')
|
||||
force_close = form.getvalue('force_close')
|
||||
mode = " mode " + form.getvalue('mode')
|
||||
ssl = ""
|
||||
|
||||
|
@ -99,6 +100,20 @@ if form.getvalue('mode') is not None:
|
|||
else:
|
||||
options_split = ""
|
||||
|
||||
if force_close == "1":
|
||||
options_split += " option http-server-close\n"
|
||||
elif force_close == "2":
|
||||
options_split += " option forceclose\n"
|
||||
elif force_close == "3":
|
||||
options_split += " option http-pretend-keepalive\n"
|
||||
|
||||
if form.getvalue('cookie'):
|
||||
cookie = " cookie "+form.getvalue('cookie_name')
|
||||
if form.getvalue('cookie_domain'):
|
||||
cookie += " domain "+form.getvalue('cookie_domain')
|
||||
cookie += " "+form.getvalue('rewrite')+" "+form.getvalue('nocache')+" "+form.getvalue('postonly')+"\n"
|
||||
options_split += cookie
|
||||
|
||||
if form.getvalue('servers') is not None:
|
||||
servers = form.getvalue('servers')
|
||||
i = servers.split("\n")
|
||||
|
@ -128,7 +143,7 @@ if form.getvalue('mode') is not None:
|
|||
funct.upload_and_restart(master[0], cfg)
|
||||
|
||||
funct.upload_and_restart(serv, cfg)
|
||||
print('<meta http-equiv="refresh" content="5; url=add.py?add=%s&conf=%s">' % (name, config_add))
|
||||
print('<meta http-equiv="refresh" content="0; url=add.py?add=%s&conf=%s">' % (name, config_add))
|
||||
|
||||
print('</div>')
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<tr>
|
||||
<td class="addName">IP and Port:</td>
|
||||
<td class="addOption">
|
||||
<input type="text" name="ip" id="ip" title="" size="15" placeholder="172.28.0.1" class="form-control"><b>:</b>
|
||||
<input type="text" name="ip" id="ip" title="" size="15" placeholder="Any" class="form-control"><b>:</b>
|
||||
<input type="number" name="port" id="listen-port" required title="Port for bind listen" size="5" placeholder="8080" class="form-control">
|
||||
<div class="tooltip tooltipTop">IP for bind listner, <b>if empty will be assignet on all IPs</b>. Start typing ip, or press down.<br>If you use <b>VRRP keep in blank</b>. If you assign an IP, the slave will not start</div>
|
||||
</td>
|
||||
|
@ -50,7 +50,7 @@
|
|||
</span>
|
||||
<div id="https-hide-listen" style="display: none;">
|
||||
<br /><span class="tooltip tooltipTop">Enter name to pem file, or press down:</span><br />
|
||||
<input type="text" name="cert" placeholder="some_cert.pem" class="form-control" size="39" id="path-cert-listen"> or upload: <input type="file" name="file"><br />
|
||||
<input type="text" name="cert" placeholder="some_cert.pem" class="form-control" size="39" id="path-cert-listen"><br />
|
||||
<label for="ssl-check-listen" style="margin-top: 5px;">Disable ssl verify on servers?</label><input type="checkbox" id="ssl-check-listen" name="ssl-check" value="ssl-check" checked>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -70,7 +70,35 @@
|
|||
<tr>
|
||||
<td class="addName">Optinons:</td>
|
||||
<td class="addOption">
|
||||
<label for="options-listen-show" style="margin-top: 5px;" title="Set options">Set</label><input type="checkbox" id="options-listen-show">
|
||||
<label for="ssl_offloading" style="margin-top: 5px;" title="Enable SSL Offloading">SSL Offloading</label><input type="checkbox" id="ssl_offloading">
|
||||
<label for="forward_for" style="margin-top: 5px;" title="Option Forward for if none">Forward for</label><input type="checkbox" id="forward_for">
|
||||
<label for="redispatch" style="margin-top: 5px;" title="Enable Redispatch">Redispatch</label><input type="checkbox" id="redispatch">
|
||||
<select name="force_close" class="force_close">
|
||||
<option disabled selected>Force HTTP close</option>
|
||||
<option>Off</option>
|
||||
<option value="1">Server only</option>
|
||||
<option value="2">Force close</option>
|
||||
<option value="3">Pretend keep alive</option>
|
||||
</select>
|
||||
<label for="cookie" style="margin-top: 5px;" title="Enable Redispatch">Set cookie</label><input type="checkbox" id="cookie" name="cookie" value="1">
|
||||
<label for="options-listen-show" style="margin-top: 5px;" title="Set options manualy">Set options</label><input type="checkbox" id="options-listen-show">
|
||||
<br>
|
||||
<span id="cookie_div" style="display: none;">
|
||||
<input type="text" placeholder="name" name="cookie_name" id="cookie_name" class="form-control"><br><br>
|
||||
<input type="text" placeholder="domain" name="cookie_domain" class="form-control"><br><br>
|
||||
<select name="rewrite">
|
||||
<option disabled selected>rewrite/insert/prefix/indirect</option>
|
||||
<option>None</option>
|
||||
<option value="rewrite">rewrite</option>
|
||||
<option value="insert">insert</option>
|
||||
<option value="prefix">prefix</option>
|
||||
<option value="indirect">indirect</option>
|
||||
</select>
|
||||
<label for="nocache" style="margin-top: 5px;" title="This option is recommended in conjunction with the insert mode when there is a cache between the client and HAProxy.">nocache</label>
|
||||
<input type="checkbox" name="nocache" value="nocache" id="nocache">
|
||||
<label for="postonly" style="margin-top: 5px;" title="This option ensures that cookie insertion will only be performed on responses to POST requests..">postonly</label>
|
||||
<input type="checkbox" name="postonly" value="postonly" id="postonly">
|
||||
</span>
|
||||
<div id="options-listen-show-div" style="display: none;">
|
||||
<div class="tooltip">
|
||||
<span style="padding-right: 10px;" class="form-control">Start typing options: </span>
|
||||
|
@ -79,14 +107,14 @@
|
|||
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
|
||||
</span>
|
||||
</div>
|
||||
<textarea name="option" title="Options thru" id="optionsInput" cols=80 placeholder="acl test hdr_beg(host) -i some_host"></textarea>
|
||||
<textarea name="option" title="Options thru" id="optionsInput" cols=80 rows=5 placeholder="acl test hdr_beg(host) -i some_host"></textarea>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName">Servers:</td>
|
||||
<td class="addOption">
|
||||
<textarea name="servers" required title="Backend servers" cols=80 placeholder="hostname ip:port"></textarea>
|
||||
<textarea name="servers" required title="Backend servers" cols=80 rows=3 placeholder="hostname ip:port"></textarea>
|
||||
<div>
|
||||
<label for="controlgroup-listen-show" style="margin-top: 5px;" title="Change default check">Cusmot check params</label>
|
||||
<input type="checkbox" id="controlgroup-listen-show" name="default-check" value="1">
|
||||
|
@ -151,7 +179,7 @@
|
|||
<tr>
|
||||
<td class="addName">IP and Port:</td>
|
||||
<td class="addOption">
|
||||
<input type="text" name="ip" id="ip1" size="15" placeholder="172.28.0.1" class="form-control"><b>:</b>
|
||||
<input type="text" name="ip" id="ip1" size="15" placeholder="Any" class="form-control"><b>:</b>
|
||||
<input type="number" name="port" required title="Port for bind frontend" placeholder="8080" class="form-control">
|
||||
<div class="tooltip tooltipTop">IP for bind listner, <b>if empty will be assignet on all IPs</b>. Start typing ip, or press down.<br>If you use <b>VRRP keep in blank</b>. If you assign an IP, the slave will not start</div>
|
||||
</td>
|
||||
|
@ -176,7 +204,16 @@
|
|||
<tr>
|
||||
<td class="addName">Optinons:</td>
|
||||
<td class="addOption">
|
||||
<label for="options-frontend-show" style="margin-top: 5px;" title="Set options">Set</label><input type="checkbox" id="options-frontend-show">
|
||||
<label for="ssl_offloading1" style="margin-top: 5px;" title="Enable SSL Offloading">SSL Offloading</label><input type="checkbox" id="ssl_offloading1">
|
||||
<label for="forward_for1" style="margin-top: 5px;" title="Option Forward for if none">Forward for</label><input type="checkbox" id="forward_for1">
|
||||
<select name="force_close" class="force_close">
|
||||
<option disabled selected>Force HTTP close</option>
|
||||
<option>Off</option>
|
||||
<option value="1">Server only</option>
|
||||
<option value="2">Force close</option>
|
||||
<option value="3">Pretend keep alive</option>
|
||||
</select>
|
||||
<label for="options-frontend-show" style="margin-top: 5px;" title="Set options manualy">Set options</label><input type="checkbox" id="options-frontend-show">
|
||||
<div id="options-frontend-show-div" style="display: none;">
|
||||
<div style="font-size: 12px; padding-bottom: 10px;">
|
||||
<span style="padding-right: 10px;">Start typing options: </span>
|
||||
|
@ -185,7 +222,7 @@
|
|||
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
|
||||
</span>
|
||||
</div>
|
||||
<textarea name="option" title="Options thru" cols=80 id="optionsInput1" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
|
||||
<textarea name="option" title="Options thru" cols=80 rows=5 id="optionsInput1" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -264,7 +301,35 @@
|
|||
<tr>
|
||||
<td class="addName">Optinons:</td>
|
||||
<td class="addOption">
|
||||
<label for="options-backend-show" style="margin-top: 5px;" title="Set options">Set</label><input type="checkbox" id="options-backend-show">
|
||||
<label for="ssl_offloading2" style="margin-top: 5px;" title="Enable SSL Offloading">SSL Offloading</label><input type="checkbox" id="ssl_offloading2">
|
||||
<label for="forward_for2" style="margin-top: 5px;" title="Option Forward for if none">Forward for</label><input type="checkbox" id="forward_for2">
|
||||
<label for="redispatch2" style="margin-top: 5px;" title="Enable Redispatch">Redispatch</label><input type="checkbox" id="redispatch2">
|
||||
<select name="force_close" class="force_close">
|
||||
<option disabled selected>Force HTTP close</option>
|
||||
<option>Off</option>
|
||||
<option value="1">Server only</option>
|
||||
<option value="2">Force close</option>
|
||||
<option value="3">Pretend keep alive</option>
|
||||
</select>
|
||||
<label for="cookie2" style="margin-top: 5px;" title="Enable Redispatch">Set cookie</label><input type="checkbox" id="cookie2" name="cookie" value="1">
|
||||
<label for="options-backend-show" style="margin-top: 5px;" title="Set options manualy">Set options</label><input type="checkbox" id="options-backend-show">
|
||||
<br>
|
||||
<span id="cookie_div2" style="display: none;">
|
||||
<input type="text" placeholder="name" name="cookie_name" id="cookie_name2" class="form-control"><br><br>
|
||||
<input type="text" placeholder="domain" name="cookie_domain" class="form-control"><br><br>
|
||||
<select name="rewrite">
|
||||
<option disabled selected>rewrite/insert/prefix/indirect</option>
|
||||
<option>None</option>
|
||||
<option value="rewrite">rewrite</option>
|
||||
<option value="insert">insert</option>
|
||||
<option value="prefix">prefix</option>
|
||||
<option value="indirect">indirect</option>
|
||||
</select>
|
||||
<label for="nocache2" style="margin-top: 5px;" title="This option is recommended in conjunction with the insert mode when there is a cache between the client and HAProxy.">nocache</label>
|
||||
<input type="checkbox" name="nocache" value="nocache" id="nocache2">
|
||||
<label for="postonly2" style="margin-top: 5px;" title="This option ensures that cookie insertion will only be performed on responses to POST requests..">postonly</label>
|
||||
<input type="checkbox" name="postonly" value="postonly" id="postonly2">
|
||||
</span>
|
||||
<div id="options-backend-show-div" style="display: none;">
|
||||
<div style="font-size: 12px; padding-bottom: 10px;">
|
||||
<span style="padding-right: 10px;">Start typing options: </span>
|
||||
|
@ -273,14 +338,14 @@
|
|||
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
|
||||
</span>
|
||||
</div>
|
||||
<textarea name="option" title="Options thru" cols=80 id="optionsInput2" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
|
||||
<textarea name="option" title="Options thru" cols=80 rows=5 id="optionsInput2" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName">Servers:</td>
|
||||
<td class="addOption">
|
||||
<textarea name="servers" title="Backend servers" required cols=80 placeholder="hostname ip:port"></textarea>
|
||||
<textarea name="servers" title="Backend servers" required cols=80 rows=3 placeholder="hostname ip:port"></textarea>
|
||||
<div>
|
||||
<label for="controlgroup-backend-show" style="margin-top: 5px;" title="Change default check" >Cusmot check params</label>
|
||||
<input type="checkbox" id="controlgroup-backend-show" name="default-check">
|
||||
|
@ -377,4 +442,9 @@
|
|||
{{ conf_add }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<script>
|
||||
$( ".force_close" ).selectmenu({
|
||||
width: 180
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -98,7 +98,7 @@
|
|||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="copyright-menu">HAproxy-WI v2.5.4.1</div>
|
||||
<div class="copyright-menu">HAproxy-WI v2.5.4.2</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 309 KiB |
Binary file not shown.
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 298 KiB |
|
@ -466,6 +466,24 @@ $( function() {
|
|||
$( "#controlgroup-backend" ).hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#cookie" ).click( function(){
|
||||
if ($('#cookie').is(':checked')) {
|
||||
$("#cookie_name" ).attr('required',true);
|
||||
$("#cookie_div").show( "fast" );
|
||||
} else {
|
||||
$("#cookie_name" ).attr('required',false);
|
||||
$("#cookie_div").hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#cookie2" ).click( function(){
|
||||
if ($('#cookie2').is(':checked')) {
|
||||
$("#cookie_name2" ).attr('required',true);
|
||||
$("#cookie_div2").show( "fast" );
|
||||
} else {
|
||||
$("#cookie_name2" ).attr('required',false);
|
||||
$("#cookie_div2").hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#check-servers-backend" ).click( function(){
|
||||
if ($('#check-servers-backend').is(':checked')) {
|
||||
$( "#rise-backend" ).attr('required',true);
|
||||
|
@ -619,6 +637,68 @@ $( function() {
|
|||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
var ssl_offloading_var = "http-request set-header X-Forwarded-Port %[dst_port] \n"+
|
||||
"http-request add-header X-Forwarded-Proto https if { ssl_fc } \n"+
|
||||
"redirect scheme https if !{ ssl_fc } \n"
|
||||
$('#ssl_offloading').click(function() {
|
||||
if($('#optionsInput').val().indexOf('ssl_fc ') == '-1') {
|
||||
$("#optionsInput").append(ssl_offloading_var)
|
||||
} else {
|
||||
replace_text("#optionsInput", ssl_offloading_var);
|
||||
}
|
||||
});
|
||||
$('#ssl_offloading1').click(function() {
|
||||
if($('#optionsInput1').val().indexOf('ssl_fc ') == '-1') {
|
||||
$("#optionsInput1").append(ssl_offloading_var)
|
||||
} else {
|
||||
replace_text("#optionsInput1", ssl_offloading_var);
|
||||
}
|
||||
|
||||
});
|
||||
$('#ssl_offloading2').click(function() {
|
||||
if($('#optionsInput2').val().indexOf('ssl_fc ') == '-1') {
|
||||
$("#optionsInput2").append(ssl_offloading_var)
|
||||
} else {
|
||||
replace_text("#optionsInput2", ssl_offloading_var);
|
||||
}
|
||||
});
|
||||
var forward_for_var = "option forwardfor if-none\n";
|
||||
$('#forward_for').click(function() {
|
||||
if($('#optionsInput').val().indexOf(forward_for_var) == '-1') {
|
||||
$("#optionsInput").append(forward_for_var)
|
||||
} else {
|
||||
replace_text("#optionsInput", forward_for_var);
|
||||
}
|
||||
});
|
||||
$('#forward_for1').click(function() {
|
||||
if($('#optionsInput1').val().indexOf(forward_for_var) == '-1') {
|
||||
$("#optionsInput1").append(forward_for_var)
|
||||
} else {
|
||||
replace_text("#optionsInput1", forward_for_var);
|
||||
}
|
||||
});
|
||||
$('#forward_for2').click(function() {
|
||||
if($('#optionsInput2').val().indexOf(forward_for_var) == '-1') {
|
||||
$("#optionsInput2").append(forward_for_var)
|
||||
} else {
|
||||
replace_text("#optionsInput2", forward_for_var);
|
||||
}
|
||||
});
|
||||
var redispatch_var = "option redispatch\n";
|
||||
$('#redispatch').click(function() {
|
||||
if($('#optionsInput').val().indexOf(redispatch_var) == '-1') {
|
||||
$("#optionsInput").append(redispatch_var)
|
||||
} else {
|
||||
replace_text("#optionsInput", redispatch_var);
|
||||
}
|
||||
});
|
||||
$('#redispatch2').click(function() {
|
||||
if($('#optionsInput2').val().indexOf(redispatch_var) == '-1') {
|
||||
$("#optionsInput2").append(redispatch_var)
|
||||
} else {
|
||||
replace_text("#optionsInput2", redispatch_var);
|
||||
}
|
||||
});
|
||||
$( "#path-cert-frontend" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
|
@ -732,3 +812,12 @@ $( function() {
|
|||
} );
|
||||
});
|
||||
});
|
||||
function replace_text(id_textarea, text_var) {
|
||||
var str = $(id_textarea).val();
|
||||
var len = str.length;
|
||||
var len_var = text_var.length;
|
||||
var beg = str.indexOf(text_var);
|
||||
var end = beg + len_var
|
||||
var text_val = str.substring(0, beg) + str.substring(end, len);
|
||||
$(id_textarea).text(text_val);
|
||||
}
|
Loading…
Reference in New Issue