I have the following fly.toml
config (also found on GitHub):
app = 'generatr'
primary_region = 'sea'
[build]
builder = 'paketobuildpacks/builder:base'
[env]
PORT = '8080'
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
size = 'shared-cpu-1x'
memory = '256mb'
cpu_kind = 'shared'
cpus = 1
[[statics]]
guest_path = "/workspace/static"
url_prefix = "/static/"
I have a small JS file that makes the following request:
function get_word() {
const url = "/api/word";
fetch(url)
.then(response => response.json())
.then(jsonResponse => {
...
});
}
However, the request fails when deployed on Fly (at https://generatr.fly.dev/) with “Mixed Blocked”. I’ve read the documentation on MDN, but have not been able to fix it. It seems to me that fly.io is serving this static file as HTTP, even with force_https = true
.
The console error message: Blocked loading mixed active content “http://generatr.fly.dev/api/word/”
.
I’m not sure how to fix this. Any help is much appreciated!
I am using Python with Flask and Jinja2 templates, and gunicorn in production.