Commit 97be9c94 authored by Joshua Tauberer's avatar Joshua Tauberer

if the user has set a http proxy or redirect on the root path of a domain,...

if the user has set a http proxy or redirect on the root path of a domain, using custom.yaml, skip the domain from the static hosting panel because it wont be serving any static files
parent 21b00e8f
...@@ -64,6 +64,7 @@ function show_web() { ...@@ -64,6 +64,7 @@ function show_web() {
var tb = $('#web_domains_existing tbody'); var tb = $('#web_domains_existing tbody');
tb.text(''); tb.text('');
for (var i = 0; i < domains.length; i++) { for (var i = 0; i < domains.length; i++) {
if (!domains[i].static_enabled) continue;
var row = $("<tr><th class='domain'><a href=''></a></th><td class='directory'><tt/></td></tr>"); var row = $("<tr><th class='domain'><a href=''></a></th><td class='directory'><tt/></td></tr>");
tb.append(row); tb.append(row);
row.find('.domain a').text('https://' + domains[i].domain); row.find('.domain a').text('https://' + domains[i].domain);
...@@ -74,6 +75,7 @@ function show_web() { ...@@ -74,6 +75,7 @@ function show_web() {
tb = $('#web_domains_custom tbody'); tb = $('#web_domains_custom tbody');
tb.text(''); tb.text('');
for (var i = 0; i < domains.length; i++) { for (var i = 0; i < domains.length; i++) {
if (!domains[i].static_enabled) continue;
if (domains[i].root != domains[i].custom_root) { if (domains[i].root != domains[i].custom_root) {
var row = $("<tr><th class='domain'><a href=''></a></th><td class='directory'><tt></td></tr>"); var row = $("<tr><th class='domain'><a href=''></a></th><td class='directory'><tt></td></tr>");
tb.append(row); tb.append(row);
......
...@@ -250,6 +250,16 @@ def install_cert(domain, ssl_cert, ssl_chain, env): ...@@ -250,6 +250,16 @@ def install_cert(domain, ssl_cert, ssl_chain, env):
return "\n".join(r for r in ret if r.strip() != "") return "\n".join(r for r in ret if r.strip() != "")
def get_web_domains_info(env): def get_web_domains_info(env):
# load custom settings so we can tell what domains have a redirect or proxy set up on '/',
# which means static hosting is not happening
custom_settings = { }
nginx_conf_custom_fn = os.path.join(env["STORAGE_ROOT"], "www/custom.yaml")
if os.path.exists(nginx_conf_custom_fn):
custom_settings = rtyaml.load(open(nginx_conf_custom_fn))
def has_root_proxy_or_redirect(domain):
return custom_settings.get(domain, {}).get('redirects', {}).get('/') or custom_settings.get(domain, {}).get('proxies', {}).get('/')
# for the SSL config panel, get cert status
def check_cert(domain): def check_cert(domain):
from status_checks import check_certificate from status_checks import check_certificate
ssl_key, ssl_certificate = get_domain_ssl_files(domain, env) ssl_key, ssl_certificate = get_domain_ssl_files(domain, env)
...@@ -273,6 +283,7 @@ def get_web_domains_info(env): ...@@ -273,6 +283,7 @@ def get_web_domains_info(env):
"root": get_web_root(domain, env), "root": get_web_root(domain, env),
"custom_root": get_web_root(domain, env, test_exists=False), "custom_root": get_web_root(domain, env, test_exists=False),
"ssl_certificate": check_cert(domain), "ssl_certificate": check_cert(domain),
"static_enabled": not has_root_proxy_or_redirect(domain),
} }
for domain in get_web_domains(env) for domain in get_web_domains(env)
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment