mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2026-03-10 01:41:44 +01:00
fix: support remote_url proxy pass
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
server{
|
server{
|
||||||
|
|
||||||
# {{ comment }}
|
# {{ comment }}
|
||||||
|
|
||||||
listen 10443 ssl;
|
listen 10443 ssl;
|
||||||
listen [::]:10443 ssl;
|
listen [::]:10443 ssl;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ server{
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
ssl_verify_depth 1;
|
ssl_verify_depth 1;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if extra_location and not extra_location["location"] == "/" %}
|
{% if extra_location and not extra_location["location"] == "/" %}
|
||||||
location {{ extra_location["location"] }} {
|
location {{ extra_location["location"] }} {
|
||||||
{{ extra_location["content"] }}
|
{{ extra_location["content"] }}
|
||||||
@@ -36,26 +36,34 @@ server{
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
location / {
|
{% if remote_url %}
|
||||||
|
location / {
|
||||||
|
proxy_pass {{ remote_url }};
|
||||||
|
proxy_ssl_server_name on;
|
||||||
|
proxy_set_header Host $proxy_host;
|
||||||
|
}
|
||||||
|
{% else %}
|
||||||
|
location / {
|
||||||
proxy_pass http://{{ targetip }}:{{ targetport }};
|
proxy_pass http://{{ targetip }}:{{ targetport }};
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
{% if extra_location["location"] == "/" %}
|
{% if extra_location["location"] == "/" %}
|
||||||
{{ extra_location["content"] }}
|
{{ extra_location["content"] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ proxy_pass_blob }}
|
|
||||||
{{ cert_header_line }}
|
{{ cert_header_line }}
|
||||||
|
{{ proxy_pass_blob }}
|
||||||
{% if basicauth %}
|
{% if basicauth %}
|
||||||
auth_basic "{{ basicauth }}";
|
auth_basic "{{ basicauth }}";
|
||||||
auth_basic_user_file /etc/nginx/{{ basicauth }}.htpasswd;
|
auth_basic_user_file /etc/nginx/{{ basicauth }}.htpasswd;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
server{
|
server{
|
||||||
|
|
||||||
# {{ comment }}
|
# {{ comment }}
|
||||||
|
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
|
|
||||||
|
|||||||
4
vm.py
4
vm.py
@@ -172,10 +172,14 @@ class VM:
|
|||||||
print(json.dumps(subdomain, indent=2))
|
print(json.dumps(subdomain, indent=2))
|
||||||
raise ValueError("'port' is not allowed with no-terminate-ssl subdomain, use http_target_port and ssl_target_port")
|
raise ValueError("'port' is not allowed with no-terminate-ssl subdomain, use http_target_port and ssl_target_port")
|
||||||
|
|
||||||
|
if "port" in subdomain and "remote_url" in subdomain:
|
||||||
|
raise ValueError("'port' is unsupported with 'remote_url', remote_url must container scheme://host:port all in one")
|
||||||
|
|
||||||
component = template.render(targetip=self.ip, targetport=targetport,
|
component = template.render(targetip=self.ip, targetport=targetport,
|
||||||
servernames=[subdomain["name"]], comment=compositeName,
|
servernames=[subdomain["name"]], comment=compositeName,
|
||||||
proxy_pass_blob=self.proxy_pass_blob,
|
proxy_pass_blob=self.proxy_pass_blob,
|
||||||
acme=not self.noTerminateACME,
|
acme=not self.noTerminateACME,
|
||||||
|
remote_url=subdomain.get("remote_url"),
|
||||||
terminate_ssl=not subdomain.get("no-terminate-ssl"),
|
terminate_ssl=not subdomain.get("no-terminate-ssl"),
|
||||||
basicauth=subdomain.get("basicauth"),
|
basicauth=subdomain.get("basicauth"),
|
||||||
extra_location=subdomain.get("extra-location"),
|
extra_location=subdomain.get("extra-location"),
|
||||||
|
|||||||
Reference in New Issue
Block a user