Skip to content

Commit

Permalink
Make it possible to support non-ssl/alternate ports for the reverseproxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ubergeek42 committed Apr 3, 2023
1 parent 53b1ee9 commit f0a4e4d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions files/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ server {
root /opt/localwww;
}

{% for server,urls in reverseproxy_sites.items() %}
{% for server,config in reverseproxy_sites.items() %}
server {
listen 80;
listen 443 ssl;
server_name {{server}};
server_name {{ server }};
ssl_certificate /etc/ssl/reverseproxy.cert;
ssl_certificate_key /etc/ssl/reverseproxy.key;

Expand All @@ -26,11 +26,11 @@ server {

# Set the hostname as a variable, this forces nginx to do a dns lookup
# otherwise it only looks it up when it starts and never refreshes it
set $server_host "{{server}}";
set $server_host "{{config.scheme|default('https')}}:https://{{config.backend_host|default(server)}}{% if config.port %}{{ ":" + config.port }}{%endif%}";

{% for item in urls %}
{% for item in config.paths|default(['/']) %}
location {% if item.exact is defined and item.exact %}={% endif %} {{ item.path }} {
proxy_pass https://$server_host
proxy_pass $server_host
{%- if not (item.exact is defined and item.exact) and item.path != '/' -%}
$request_uri
{%- else -%}
Expand Down

0 comments on commit f0a4e4d

Please sign in to comment.