Open GrahamDumpleton opened 5 years ago
Should note that right now this doesn't address getting the web socket stuff which works at /cable
working. I don't understand what that is actually for at this point, so haven't made changes so that the handler for that special URL is re-hosted with sub URL as additional prefix.
Will also need to fix up lib/workshopper/lab.rb
so markdown image inclusion works. Specifically the render()
methods for ModulePath
and ImagePath
.
This includes changes to adjust how URLs are generated when performing redirects so that the URLs generated are correct when the application is hosted at a URL.
For URL generation, the change is to swap from hard coded absolute URL paths, to calculating the URL path from the controller/action specified for the route, which is the recommended practice anyway. This is needed in the redirects in the controllers, but also where generating the URL path for embedding images.
To allow hosting at a sub URL a Rack middleware is also required to fix up the Rack request environment so that the Rails application is able to work when it is mounted at a sub URL. This is needed specifically because Rack is used to wrap Rails and is in addition to setting various Rails environment variables.
To host at a sub URL, one would set the environment variables:
cc @jorgemoralespou