|
@@ -5,6 +5,12 @@
|
|
|
<link rel="stylesheet" href="../script/semantic/semantic.min.css">
|
|
|
<script src="../script/jquery-3.6.0.min.js"></script>
|
|
|
<script src="../script/semantic/semantic.min.js"></script>
|
|
|
+ <style>
|
|
|
+ .ui.tabular.menu .item.narrowpadding{
|
|
|
+ padding: 0.6em !important;
|
|
|
+ margin: 0.15em !important;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<br>
|
|
@@ -16,52 +22,80 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="ui divider"></div>
|
|
|
- <p>You can define custom headers to be sent
|
|
|
- together with the client request to the backend server in
|
|
|
- this reverse proxy endpoint / host.</p>
|
|
|
-
|
|
|
- <table class="ui very basic compacted unstackable celled table">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>Key</th>
|
|
|
- <th>Value</th>
|
|
|
- <th>Remove</th>
|
|
|
- </tr></thead>
|
|
|
- <tbody id="headerTable">
|
|
|
- <tr>
|
|
|
- <td colspan="3"><i class="ui green circle check icon"></i> No Additonal Header</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- <div class="ui divider"></div>
|
|
|
- <h4>Edit Custom Header</h4>
|
|
|
- <p>Add or remove custom header(s) over this proxy target</p>
|
|
|
- <div class="scrolling content ui form">
|
|
|
- <div class="five small fields credentialEntry">
|
|
|
- <div class="field" align="center">
|
|
|
- <button id="toOriginButton" title="Downstream to Upstream" class="ui circular basic active button">Zoraxy <i class="angle double right blue icon" style="margin-right: 0.4em;"></i> Origin</button>
|
|
|
- <button id="toClientButton" title="Upstream to Downstream" class="ui circular basic button">Client <i class="angle double left orange icon" style="margin-left: 0.4em;"></i> Zoraxy</button>
|
|
|
- </div>
|
|
|
- <div class="field" align="center">
|
|
|
- <button id="headerModeAdd" class="ui circular basic active button"><i class="ui green circle add icon"></i> Add Header</button>
|
|
|
- <button id="headerModeRemove" class="ui circular basic button"><i class="ui red circle times icon"></i> Remove Header</button>
|
|
|
- </div>
|
|
|
- <div class="field">
|
|
|
- <label>Header Key</label>
|
|
|
- <input id="headerName" type="text" placeholder="X-Custom-Header" autocomplete="off">
|
|
|
- <small>The header key is <b>NOT</b> case sensitive</small>
|
|
|
- </div>
|
|
|
- <div class="field">
|
|
|
- <label>Header Value</label>
|
|
|
- <input id="headerValue" type="text" placeholder="value1,value2,value3" autocomplete="off">
|
|
|
- </div>
|
|
|
- <div class="field" >
|
|
|
- <button class="ui basic button" onclick="addCustomHeader();"><i class="green add icon"></i> Add Header Rewrite Rule</button>
|
|
|
+ <div class="ui small pointing secondary menu">
|
|
|
+ <a class="item active narrowpadding" data-tab="customheaders">Custom Headers</a>
|
|
|
+ <a class="item narrowpadding" data-tab="security">Security Headers</a>
|
|
|
+ </div>
|
|
|
+ <div class="ui tab basic segment active" data-tab="customheaders">
|
|
|
+ <table class="ui very basic compacted unstackable celled table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>Key</th>
|
|
|
+ <th>Value</th>
|
|
|
+ <th>Remove</th>
|
|
|
+ </tr></thead>
|
|
|
+ <tbody id="headerTable">
|
|
|
+ <tr>
|
|
|
+ <td colspan="3"><i class="ui green circle check icon"></i> No Additonal Header</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <p>
|
|
|
+ <i class="angle double right blue icon"></i> Sent additional custom headers to origin server <br>
|
|
|
+ <i class="angle double left orange icon"></i> Inject custom headers into origin server responses
|
|
|
+ </p>
|
|
|
+ <div class="ui divider"></div>
|
|
|
+ <h4>Edit Custom Header</h4>
|
|
|
+ <p>Add or remove custom header(s) over this proxy target</p>
|
|
|
+ <div class="scrolling content ui form">
|
|
|
+ <div class="five small fields credentialEntry">
|
|
|
+ <div class="field" align="center">
|
|
|
+ <button id="toOriginButton" style="margin-top: 0.6em;" title="Downstream to Upstream" class="ui circular basic active button">Zoraxy <i class="angle double right blue icon" style="margin-right: 0.4em;"></i> Origin</button>
|
|
|
+ <button id="toClientButton" style="margin-top: 0.6em;" title="Upstream to Downstream" class="ui circular basic button">Client <i class="angle double left orange icon" style="margin-left: 0.4em;"></i> Zoraxy</button>
|
|
|
+ </div>
|
|
|
+ <div class="field" align="center">
|
|
|
+ <button id="headerModeAdd" style="margin-top: 0.6em;" class="ui circular basic active button"><i class="ui green circle add icon"></i> Add Header</button>
|
|
|
+ <button id="headerModeRemove" style="margin-top: 0.6em;" class="ui circular basic button"><i class="ui red circle times icon"></i> Remove Header</button>
|
|
|
+ </div>
|
|
|
+ <div class="field">
|
|
|
+ <label>Header Key</label>
|
|
|
+ <input id="headerName" type="text" placeholder="X-Custom-Header" autocomplete="off">
|
|
|
+ <small>The header key is <b>NOT</b> case sensitive</small>
|
|
|
+ </div>
|
|
|
+ <div class="field">
|
|
|
+ <label>Header Value</label>
|
|
|
+ <input id="headerValue" type="text" placeholder="value1,value2,value3" autocomplete="off">
|
|
|
+ </div>
|
|
|
+ <div class="field" >
|
|
|
+ <button class="ui basic button" onclick="addCustomHeader();"><i class="green add icon"></i> Add Header Rewrite Rule</button>
|
|
|
+ </div>
|
|
|
+ <div class="ui divider"></div>
|
|
|
</div>
|
|
|
- <div class="ui divider"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="ui divider"></div>
|
|
|
+ <div class="ui tab basic segment" data-tab="security">
|
|
|
+ <h4>HTTP Strict Transport Security</h4>
|
|
|
+ <p>Force future attempts to access this site to only use HTTPS</p>
|
|
|
+ <div class="ui toggle checkbox">
|
|
|
+ <input type="checkbox" id="enableHSTS" name="enableHSTS">
|
|
|
+ <label>Enable HSTS<br>
|
|
|
+ <small>HSTS header will be automatically ignored if the site is accessed using HTTP</small></label>
|
|
|
+ </div>
|
|
|
+ <div class="ui divider"></div>
|
|
|
+ <h4>Permission Policy</h4>
|
|
|
+ <p>Explicitly declare what functionality can and cannot be used on this website. </p>
|
|
|
+ <div class="ui toggle checkbox" style="margin-top: 0.6em;">
|
|
|
+ <input type="checkbox" name="enableHSTS">
|
|
|
+ <label>Enable Permission Policy<br>
|
|
|
+ <small>Enable Permission-Policy header with all allowed state.</small></label>
|
|
|
+ </div>
|
|
|
+ <div id="permissionPolicyEditTable">
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <br><br>
|
|
|
+ <button class="ui basic button"><i class="green save icon"></i> Save</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="field" >
|
|
|
<button class="ui basic button" style="float: right;" onclick="closeThisWrapper();">Close</button>
|
|
|
</div>
|
|
@@ -70,6 +104,8 @@
|
|
|
<br><br><br><br>
|
|
|
|
|
|
<script>
|
|
|
+ $('.menu .item').tab();
|
|
|
+
|
|
|
let editingEndpoint = {};
|
|
|
if (window.location.hash.length > 1){
|
|
|
let payloadHash = window.location.hash.substr(1);
|
|
@@ -239,6 +275,40 @@
|
|
|
});
|
|
|
}
|
|
|
listCustomHeaders();
|
|
|
+
|
|
|
+ /* Bind events to toggles */
|
|
|
+ $.get("/api/proxy/header/handleHSTS?domain=" + editingEndpoint.ep, function(data){
|
|
|
+ if (data == 0){
|
|
|
+ //HSTS disabled
|
|
|
+ $("#enableHSTS").parent().checkbox("set unchecked");
|
|
|
+ }else{
|
|
|
+ //HSTS enabled
|
|
|
+ $("#enableHSTS").parent().checkbox("set checked");
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#enableHSTS").on("change", function(){
|
|
|
+ let HSTSEnabled = $("#enableHSTS")[0].checked;
|
|
|
+ $.ajax({
|
|
|
+ url: "/api/proxy/header/handleHSTS",
|
|
|
+ method: "POST",
|
|
|
+ data: {
|
|
|
+ "domain": editingEndpoint.ep,
|
|
|
+ "maxage": 31536000
|
|
|
+ },
|
|
|
+ success: function(data){
|
|
|
+ if (data.error != undefined){
|
|
|
+ parent.msgbox(data.error, false);
|
|
|
+ }else{
|
|
|
+ parent.msgbox(`HSTS ${HSTSEnabled?"Enabled":"Disabled"}`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ /* List permission policy header from server */
|
|
|
+
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|