123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <div class="standardContainer">
- <div class="ui basic segment">
- <h2>Set Proxy Root</h2>
- <p>The default routing point for all incoming traffics. For all routing not found in the proxy rules, request will be redirected to the proxy root server.</p>
- <div class="ui form">
- <div class="field">
- <label>Proxy Root</label>
- <input type="text" id="proxyRoot" onchange="checkRootRequireTLS(this.value);">
- <small>E.g. localhost:8080</small>
- </div>
- <div class="field">
- <div class="ui checkbox">
- <input type="checkbox" id="rootReqTLS">
- <label>Root require TLS Connection <br><small>(i.e. Your proxy target starts with https://)</small></label>
- </div>
- </div>
- <br>
- <button class="ui basic button" onclick="setProxyRoot()"><i class="teal home icon" ></i> Update Proxy Root</button>
- <!-- Advance configs -->
- <div class="ui basic segment" style="background-color: #f7f7f7; border-radius: 1em;">
- <div id="advanceRootSettings" class="ui fluid accordion">
- <div class="title">
- <i class="dropdown icon"></i>
- Advance Root Routing Settings
- </div>
- <div class="content">
- <h4>Force Root Redirect for Unset Sub-domains</h4>
- <p>Enabling this option will force redirect user back to root if the user is requesting a sub-domain that is not registered in this layer of reverse proxy. <br>
- (Recommend for top-level reverse proxy setup only)</p>
- <div class="field">
- <div class="ui checkbox">
- <input type="checkbox" id="forceUnsetSubdRedirect">
- <label>Enable force redirect</label>
- </div>
- </div>
- <div class="ui divider"></div>
- </div>
- </div>
- </div>
- </div>
- <br>
-
- </div>
- </div>
- <script>
- $("#advanceRootSettings").accordion();
- function initRootInfo(){
- $.get("/api/proxy/list?type=root", function(data){
- if (data == null){
- }else{
- $("#proxyRoot").val(data.Domain);
- checkRootRequireTLS(data.Domain);
- }
- });
- }
- initRootInfo();
- function checkRootRequireTLS(targetDomain){
- $.ajax({
- url: "/api/proxy/tlscheck",
- data: {url: targetDomain},
- success: function(data){
- if (data.error != undefined){
- }else if (data == "https"){
- $("#rootReqTLS").parent().checkbox("set checked");
- }else if (data == "http"){
- $("#rootReqTLS").parent().checkbox("set unchecked");
- }
- //Trim off the http or https from the origin
- if (targetDomain.startsWith("http://")){
- targetDomain = targetDomain.substring(7);
- $("#proxyRoot").val(targetDomain);
- }else if (targetDomain.startsWith("https://")){
- targetDomain = targetDomain.substring(8);
- $("#proxyRoot").val(targetDomain);
- }
- }
- })
- }
- function setProxyRoot(){
- var newpr = $("#proxyRoot").val();
- if (newpr.trim() == ""){
- $("#proxyRoot").parent().addClass('error');
- return
- }else{
- $("#proxyRoot").parent().removeClass('error');
- }
- var rootReqTls = $("#rootReqTLS")[0].checked;
- //Create the endpoint by calling add
- $.ajax({
- url: "/api/proxy/add",
- data: {"type": "root", tls: rootReqTls, ep: newpr},
- success: function(data){
- if (data.error != undefined){
- alert(data.error);
- }else{
- //OK
- initRootInfo();
- msgbox("Proxy Root Updated")
- }
- }
- });
- }
- </script>
|