diff --git a/app/add.py b/app/add.py index 4721066..18d8ba9 100644 --- a/app/add.py +++ b/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('' % (name, config_add)) + print('' % (name, config_add)) print('') diff --git a/app/templates/add.html b/app/templates/add.html index 101fffc..8570969 100644 --- a/app/templates/add.html +++ b/app/templates/add.html @@ -32,7 +32,7 @@ IP and Port: - : + :
IP for bind listner, if empty will be assignet on all IPs. Start typing ip, or press down.
If you use VRRP keep in blank. If you assign an IP, the slave will not start
@@ -50,7 +50,7 @@ @@ -70,7 +70,35 @@ Optinons: - + + + + + + +
+ Servers: - +
@@ -151,7 +179,7 @@ IP and Port: - : + :
IP for bind listner, if empty will be assignet on all IPs. Start typing ip, or press down.
If you use VRRP keep in blank. If you assign an IP, the slave will not start
@@ -176,7 +204,16 @@ Optinons: - + + + + @@ -264,8 +301,36 @@ Optinons: - -
diff --git a/image/haproxy-wi-add-listen.jpeg b/image/haproxy-wi-add-listen.jpeg index c2aa3e3..5a9d20f 100644 Binary files a/image/haproxy-wi-add-listen.jpeg and b/image/haproxy-wi-add-listen.jpeg differ diff --git a/image/haproxy-wi-admin-area.jpeg b/image/haproxy-wi-admin-area.jpeg index 1c54812..e928688 100644 Binary files a/image/haproxy-wi-admin-area.jpeg and b/image/haproxy-wi-admin-area.jpeg differ diff --git a/inc/script.js b/inc/script.js index 281c658..ffd5a88 100644 --- a/inc/script.js +++ b/inc/script.js @@ -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( { @@ -731,4 +811,13 @@ $( function() { } } ); }); -}); \ No newline at end of file +}); +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); +} \ No newline at end of file