Skip to content

Commit

Permalink
Merge pull request #12 from Tivix/ip_redir
Browse files Browse the repository at this point in the history
add option to redirect from bare ip
  • Loading branch information
nemd committed Jul 15, 2024
2 parents 8981e5d + ecbd0a7 commit 09a6552
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ services:
- CSP_OBJECT_SRC=object-src.com
- CSP_MEDIA_SRC=media-src.com
- CSP_FRAME_SRC=frame-src.com
- IP_REDIRECT=false
- IP_SERVER=123.123.123.123
- IP_DOMAIN=example.com
depends_on:
- service_a
- service_b
Expand Down
8 changes: 8 additions & 0 deletions templates/site.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ server {
}
{%- endif %}

{%- if IP_REDIRECT == 'true' %}
server {
listen 0.0.0.0:{{ env('NGINX_PORT', '80') }};
server_name {{ IP_SERVER }};
return 301 https://{{ IP_DOMAIN }}$request_uri;
}
{%- endif %}

{%- if MICROCACHE == 'true' %}
proxy_cache_path /cache levels=1:2 keys_zone=microcache:100m max_size=100m inactive=1h use_temp_path=off;
{%- endif %}
Expand Down

0 comments on commit 09a6552

Please sign in to comment.