diff --git a/backend/siarnaq/api/compete/models.py b/backend/siarnaq/api/compete/models.py index 23aef701f..9b7d02517 100644 --- a/backend/siarnaq/api/compete/models.py +++ b/backend/siarnaq/api/compete/models.py @@ -163,7 +163,7 @@ def for_saturn(self): def enqueue_options(self): """Return the options to be submitted to the compilation queue.""" - report_url = "http://{}{}".format( + report_url = "https://{}{}".format( settings.ALLOWED_HOSTS[0], reverse( "submission-report", @@ -257,7 +257,7 @@ def for_saturn(self): def enqueue_options(self): """Return the options to be submitted to the execution queue.""" - report_url = "http://{}{}".format( + report_url = "https://{}{}".format( settings.ALLOWED_HOSTS[0], reverse( "match-report", diff --git a/backend/siarnaq/api/episodes/signals.py b/backend/siarnaq/api/episodes/signals.py index 85702ee55..492b375e6 100644 --- a/backend/siarnaq/api/episodes/signals.py +++ b/backend/siarnaq/api/episodes/signals.py @@ -50,7 +50,7 @@ def update_autoscrim_schedule(instance, update_fields, **kwargs): f"{parent}/jobs/" f"{settings.GCLOUD_SCHEDULER_PREFIX}-autoscrim-{instance.name_short}" ) - url = "http://{}{}".format( + url = "https://{}{}".format( settings.ALLOWED_HOSTS[0], reverse("episode-autoscrim", kwargs={"pk": instance.pk}), ) diff --git a/deploy/main.tf b/deploy/main.tf index 229f513b3..3596cef94 100644 --- a/deploy/main.tf +++ b/deploy/main.tf @@ -105,7 +105,7 @@ module "production_network" { gcp_region = var.gcp_region gcp_zone = var.gcp_zone - use_ssl = true + https_redirect = true subdomain = "" cloudrun_service_name = module.production.run_service_name sql_instance_ip = module.production.sql_instance_ip @@ -134,7 +134,7 @@ module "staging_network" { gcp_region = var.gcp_region gcp_zone = var.gcp_zone - use_ssl = false + https_redirect = false subdomain = "staging." cloudrun_service_name = module.staging.run_service_name sql_instance_ip = module.staging.sql_instance_ip diff --git a/deploy/network/main.tf b/deploy/network/main.tf index 2df7b5a8e..73c293fc4 100644 --- a/deploy/network/main.tf +++ b/deploy/network/main.tf @@ -39,10 +39,10 @@ module "lb" { url_map = google_compute_url_map.this.self_link create_url_map = false - https_redirect = var.use_ssl + https_redirect = var.https_redirect firewall_networks = [] - ssl = var.use_ssl + ssl = true use_ssl_certificates = false managed_ssl_certificate_domains = [for subdomain in local.subdomains : "${subdomain}battlecode.org" ] diff --git a/deploy/network/variables.tf b/deploy/network/variables.tf index 283ea64ae..c5f5b2bcf 100644 --- a/deploy/network/variables.tf +++ b/deploy/network/variables.tf @@ -23,8 +23,8 @@ variable "subdomain" { type = string } -variable "use_ssl" { - description = "Whether to use and redirect to SSL." +variable "https_redirect" { + description = "Whether to redirect to SSL." type = bool } diff --git a/saturn/pkg/saturn/report.go b/saturn/pkg/saturn/report.go index 64a0dbac1..65011ac24 100644 --- a/saturn/pkg/saturn/report.go +++ b/saturn/pkg/saturn/report.go @@ -29,24 +29,6 @@ func NewGCPTokenedReporter( if err != nil { return nil, fmt.Errorf("idtoken.NewClient: %v", err) } - - // Allow following redirect for POST requests - client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - if len(via) >= 10 { - return fmt.Errorf("stopped after 10 redirects") - } - if via[0].GetBody == nil { - return fmt.Errorf("could not get original body") - } - - var err error - req.Method = http.MethodPost - req.Body, err = via[0].GetBody() - if err != nil { - return fmt.Errorf("GetBody: %v", err) - } - return nil - } return &GCPTokenedReporter{client, userAgent}, nil }