1
0

rproot.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <h3><i class="ui home icon"></i> Set Proxy Root</h3>
  2. <p>For all routing not found in the proxy rule, will be redirected to the proxy root server.</p>
  3. <div class="ui form">
  4. <div class="field">
  5. <label>Proxy Root</label>
  6. <input type="text" id="proxyRoot">
  7. <small>E.g. localhost:8080</small>
  8. </div>
  9. <div class="field">
  10. <div class="ui checkbox">
  11. <input type="checkbox" id="rootReqTLS">
  12. <label>Root require TLS Connection <br><small>(i.e. Your proxy target starts with https://)</small></label>
  13. </div>
  14. </div>
  15. </div>
  16. <br>
  17. <button class="ui teal button" onclick="setProxyRoot()"><i class="home icon" ></i> Set Proxy Root</button>
  18. <div class="ui green message" id="ProxyRootUpdate" style="display:none">
  19. <i class="ui checkmark icon"></i> Proxy Root Updated
  20. </div>
  21. <script>
  22. function initRootInfo(){
  23. $.get("/api/proxy/list?type=root", function(data){
  24. if (data == null){
  25. }else{
  26. $("#proxyRoot").val(data.Domain);
  27. }
  28. });
  29. }
  30. initRootInfo();
  31. function setProxyRoot(){
  32. var newpr = $("#proxyRoot").val();
  33. if (newpr.trim() == ""){
  34. $("#proxyRoot").parent().addClass('error');
  35. return
  36. }else{
  37. $("#proxyRoot").parent().removeClass('error');
  38. }
  39. var rootReqTls = $("#rootReqTLS")[0].checked;
  40. //Create the endpoint by calling add
  41. $.ajax({
  42. url: "/api/proxy/add",
  43. data: {"type": "root", tls: rootReqTls, ep: newpr},
  44. success: function(data){
  45. if (data.error != undefined){
  46. alert(data.error);
  47. }else{
  48. //OK
  49. initRootInfo();
  50. $("#ProxyRootUpdate").stop().slideDown('fast').delay(3000).slideUp('fast');
  51. }
  52. }
  53. });
  54. }
  55. </script>