I have an app running without any issues on Apps v1 and I’m now trying to migrate it to Machines API. deploy is working fine, app opens without issues but I can’t do any POST request, I keep getting this error
for some reason, request.base_url is suffixed with http while the header has https. not really sure how to fix this since all I found on Google tells me to update Nginx config files but, well…
I suspected it could be some CORS config thing but my configuration has nothing special
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins "*"
resource "/assets/*",
headers: :any,
methods: %i[get head options]
end
end
I have a Rails 7 app that I migrated to machines without any problems. But perhaps the fact that I had the following in my config/environments/production.rb was the reason why:
config.force_ssl = true
The reason why I have this in my config is unrelated to fly, but rather due to how I originally had my app set up - with an apache httpd reverse proxy.
hmm, just added it and now I get ERR_TOO_MANY_REDIRECTS on chrome.
I also suspected it had something to do with this part of the machine configuration: -p 443:8080/tcp:tsl. I tried different combinations just to make sure it wasn’t it but 443:8080/tcp:tsl is the only setup where the app actually loads
quick update on this one: I managed to get it working, setting config.force_ssl = true and proxying the app with Cloudflare but I noticed something: the database performance is terrible. I’m using a Postgres machine in fra cloned in gru (where I’m currently sitting). the gru is the replica while fra is the primary. I configured my database.yml as follow: