Support hotwire over subdomains?

Hi community,

Any guidance w.r.t how to force hotwire to support subdomains for replacing turbo-frames in response from a different subdomain, on link click or form submission?

Hotwire handbook - As per hotwire handbook, turbo drive only loads url with same domain. It allows further scoping to a subdirectory, but not widening scope to subdomains.

My situation -

  • Main subdomain “www” fetches from CDN - All my pages are cached and served from CDN (used for 90% of website)
  • Second subomain - “app”. This is used for User specific interactions on the pages served from the CDN (eg. “Add a comment”)

I was hoping that I could force my CDN served pages on “www” to be able to hotwire responses from “app” for small user interactions.

Prior to Rails 7/hotwire - I did the same by using js/erb responses.

Any guidance on doing this through (1) hotwire config, or (2) Rails 7 specific JS code - will be great?


1 Like