Editing when SSL, PATCHES, and JS failing, turbolinks confused?
Donal O Duibhir•
Hi mostly got everything up and running. Working fine serving via HTTPS reverse NGINX proxy with SSL also enabled in development environment (config.force_ssl = true) and NGINX proxy pass is to http://localhost:3000, but any attempt to edit accounts from 'https://localapp.pansift.com/admin/accounts/2/edit' results in the JS using "https://localhost:3000/admin/accounts/2" + ends up in error as per below (although the record is saved)..
(It's quite likely I am missing something basic though and haven't completed customization).
Started PATCH "/admin/accounts/2" for ::ffff:172.18.0.1 at 2021-03-29 14:46:00 +0100
Cannot render console from ::ffff:172.18.0.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
Processing by Admin::AccountsController#update as TURBO_STREAM
Parameters: {"authenticity_token"=>"2-1ExOyvtQrMTLyAfyPbo5zfz560PF1Kjk3W2R0BDCY72q_bZQEa1uBeqBBIKavSukQnBXrq9N5Q4Hh6Inrg6Q", "account"=>{"owner_id"=>"1", "name"=>"[FILTERED]", "personal"=>"0", "extra_billing_info"=>""}, "commit"=>"Update Account", "id"=>"2"}
Account Load (0.4ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
↳ app/controllers/administrate/application_controller.rb:139:in `find_resource'
TRANSACTION (0.2ms) BEGIN
↳ app/controllers/administrate/application_controller.rb:61:in `update'
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
↳ app/controllers/administrate/application_controller.rb:61:in `update'
Account Update (0.5ms) UPDATE "accounts" SET "name" = $1, "updated_at" = $2 WHERE "accounts"."id" = $3 [["name", "Pansift Organisation"], ["updated_at", "2021-03-29 13:46:00.118430"], ["id", 2]]
↳ app/controllers/administrate/application_controller.rb:61:in `update'
TRANSACTION (18.6ms) COMMIT
↳ app/controllers/administrate/application_controller.rb:61:in `update'
**Redirected to https://localhost:3000/admin/accounts/2**
Completed 302 Found in 31ms (ActiveRecord: 20.0ms | Allocations: 5280)
Note: The Update goes through i.e. saves the record (you can see the new value on refresh) but the JS errors out.
Chrome Developer Tools
I am wondering do I need to set an XXXXX.default_url_options somewhere to override the JS call that attempts to use "https://localhost:3000/admin/accounts/2" i.e. to use NGINX reverse + hostname instead?