From 321734a453837521b27d142d0273c61a88d33327 Mon Sep 17 00:00:00 2001 From: shockrah Date: Tue, 14 Feb 2023 18:52:23 -0800 Subject: [PATCH] Adding redirect for 80 which was causing issues on folder path calls to nginx --- docker/beta/nginx.conf | 11 +++++++++-- infra/load-balancer.tf | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docker/beta/nginx.conf b/docker/beta/nginx.conf index 56e54da..174f576 100644 --- a/docker/beta/nginx.conf +++ b/docker/beta/nginx.conf @@ -35,14 +35,21 @@ http { server { server_name "shockrah.xyz"; + root /var/www/shockrah.xyz; + index index.html; + location / { - root /var/www/shockrah.xyz; + try_files $uri $uri/ /index.html; } } server { server_name "resume.shockrah.xyz"; + + root /var/www/resume.shockrah.xyz; + index index.html; + location / { - root /var/www/resume.shockrah.xyz; + try_files $uri $uri/ =404; } } } diff --git a/infra/load-balancer.tf b/infra/load-balancer.tf index 82324af..11c028d 100644 --- a/infra/load-balancer.tf +++ b/infra/load-balancer.tf @@ -31,6 +31,21 @@ resource "aws_lb_target_group" "shockrah_xyz" { } } +resource "aws_lb_listener" "http" { + load_balancer_arn = aws_lb.alpha.arn + port = 80 + protocol = "HTTP" + default_action { + type = "redirect" + + redirect { + port = 443 + protocol = "HTTPS" + status_code = "HTTP_301" + } + } +} + resource "aws_lb_listener" "https" { load_balancer_arn = aws_lb.alpha.arn port = 443