mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
ui - redirect setup wizard to https and configure fallback self-signed cert if LE is not used
This commit is contained in:
parent
67a08031e1
commit
798c1b79d5
3 changed files with 15 additions and 9 deletions
|
|
@ -1,4 +1,13 @@
|
|||
{% if UI_HOST != "" and not has_variable(all, "USE_UI", "yes") +%}
|
||||
access_by_lua_block {
|
||||
local ngx_var = ngx.var
|
||||
local scheme = ngx_var.scheme
|
||||
local http_host = ngx_var.http_host
|
||||
local request_uri = ngx_var.request_uri
|
||||
if scheme == "http" and http_host ~= nil and http_host ~= "" and request_uri and request_uri ~= "" then
|
||||
return ngx.redirect("https://" .. http_host .. request_uri, ngx.HTTP_MOVED_PERMANENTLY)
|
||||
end
|
||||
}
|
||||
location /setup {
|
||||
etag off;
|
||||
add_header Last-Modified "";
|
||||
|
|
|
|||
|
|
@ -576,6 +576,7 @@ def setup():
|
|||
"REVERSE_PROXY_HOST": request.form["ui_host"],
|
||||
"REVERSE_PROXY_URL": request.form["ui_url"] or "/",
|
||||
"AUTO_LETS_ENCRYPT": request.form.get("auto_lets_encrypt", "no"),
|
||||
"GENERATE_SELF_SIGNED_SSL": "yes" if request.form.get("auto_lets_encrypt", "no") == "no" else "no",
|
||||
"INTERCEPTED_ERROR_CODES": "400 404 405 413 429 500 501 502 503 504",
|
||||
"MAX_CLIENT_SIZE": "50m",
|
||||
},
|
||||
|
|
|
|||
14
src/ui/templates/setup.html
vendored
14
src/ui/templates/setup.html
vendored
|
|
@ -320,7 +320,7 @@
|
|||
Your BunkerWeb UI final URL will be
|
||||
</h5>
|
||||
<p class="family-text text-center text-sm md:text-base break-words w-full px-4"
|
||||
data-resume>http://</p>
|
||||
data-resume>https://</p>
|
||||
</div>
|
||||
<div class="col-span-12 flex justify-center">
|
||||
<button tabindex="2"
|
||||
|
|
@ -370,7 +370,7 @@
|
|||
e.preventDefault();
|
||||
this.updateCheck("unknown");
|
||||
// get resume
|
||||
const api = `http://${this.servInp.value}/setup/check`;
|
||||
const api = `${location.protocol}://${this.servInp.value}/setup/check`;
|
||||
fetch(api)
|
||||
.then((res) => {
|
||||
this.updateCheck("success");
|
||||
|
|
@ -437,14 +437,12 @@
|
|||
}
|
||||
|
||||
updateResume() {
|
||||
this.servInp.value = this.servInp.value.replace('https://', '').replace('http://', '');
|
||||
this.servInp.value = this.servInp.value.replace('https://', '');
|
||||
if (!this.urlInp.value.startsWith("/")) {
|
||||
this.urlInp.value = "/" + this.urlInp.value;
|
||||
}
|
||||
this.urlInp.value = this.urlInp.value.replace("//", "/");
|
||||
this.resumeEl.textContent = `http${
|
||||
this.sslCheck.getAttribute("data-checked") === "true" ? "s" : ""
|
||||
}://${this.servInp.value}${this.urlInp.value}`;
|
||||
this.resumeEl.textContent = `https://${this.servInp.value}${this.urlInp.value}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -600,9 +598,7 @@
|
|||
|
||||
// send form and wait for response
|
||||
|
||||
let api = `http${
|
||||
this.sslCheck.getAttribute("data-checked") === "true" ? "s" : ""
|
||||
}://${this.servInp.value}${this.urlInp.value}`;
|
||||
let api = `https://${this.servInp.value}${this.urlInp.value}`;
|
||||
if (!api.endsWith("/")) {
|
||||
api = `${api}/`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue