rules.html 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <h3><i class="ui exchange icon"></i> New Proxy Endpoint</h3>
  2. <p>You can create a proxy endpoing by subdomain or virtual directories</p>
  3. <div class="ui form">
  4. <div class="field">
  5. <label>Proxy Type</label>
  6. <div class="ui selection dropdown">
  7. <input type="hidden" id="ptype" value="subd">
  8. <i class="dropdown icon"></i>
  9. <div class="default text">Proxy Type</div>
  10. <div class="menu">
  11. <div class="item" data-value="subd">Sub-domain</div>
  12. <div class="item" data-value="vdir">Virtual Directory</div>
  13. </div>
  14. </div>
  15. </div>
  16. <div class="field">
  17. <label>Subdomain Matching Keyword / Virtual Directory Name</label>
  18. <input type="text" id="rootname" placeholder="s1.mydomain.com">
  19. <div class="ui message">
  20. Example of subdomain matching keyword:<br>
  21. <code>s1.arozos.com</code> <br>(Any access starting with s1.arozos.com will be proxy to the IP address below)<br>
  22. Example of virtual directory name: <br>
  23. <code>/s1/home</code> <br>(Any access to {this_server}/s1/ will be proxy to the IP address below)
  24. </div>
  25. </div>
  26. <div class="field">
  27. <label>IP Address or Domain Name with port</label>
  28. <input type="text" id="proxyDomain">
  29. <small>E.g. 192.168.0.101:8000 or example.com</small>
  30. </div>
  31. <div class="field">
  32. <div class="ui checkbox">
  33. <input type="checkbox" id="reqTls">
  34. <label>Proxy Target require TLS Connection <br><small>(i.e. Your proxy target starts with https://)</small></label>
  35. </div>
  36. </div>
  37. <button class="ui teal button" onclick="newProxyEndpoint();">Create Proxy Endpoint</button>
  38. </div>
  39. <div class="ui green message" id="proxyaddSucc" style="display:none">
  40. <i class="ui checkmark icon"></i> Proxy Endpoint Added
  41. </div>
  42. <script>
  43. //New Proxy Endpoint
  44. function newProxyEndpoint(){
  45. var type = $("#ptype").val();
  46. var rootname = $("#rootname").val();
  47. var proxyDomain = $("#proxyDomain").val();
  48. var useTLS = $("#reqTls")[0].checked;
  49. if (rootname.trim() == ""){
  50. $("#rootname").parent().addClass("error");
  51. return
  52. }else{
  53. $("#rootname").parent().removeClass("error");
  54. }
  55. if (proxyDomain.trim() == ""){
  56. $("#proxyDomain").parent().addClass("error");
  57. return
  58. }else{
  59. $("#proxyDomain").parent().removeClass("error");
  60. }
  61. //Create the endpoint by calling add
  62. $.ajax({
  63. url: "./add",
  64. data: {type: type, rootname: rootname, tls: useTLS, ep: proxyDomain},
  65. success: function(data){
  66. if (data.error != undefined){
  67. alert(data.error);
  68. }else{
  69. //OK
  70. listVdirs();
  71. listSubd();
  72. $("#proxyaddSucc").stop().slideDown('fast').delay(3000).slideUp('fast');
  73. //Clear old data
  74. $("#rootname").val("");
  75. $("#proxyDomain").val("");
  76. }
  77. }
  78. });
  79. }
  80. </script>