Open
Description
Feature Request
Is your feature request related to a problem?
yes and no. we have a Rails application which can run under a relative root url, configured with ActionController::Base.config.relative_url_root
. what we noted is:
- the reflex is sent with the full path, including the value configured in
config.relative_url_root
. - StimulusReflex is then unable to resolve the corresponding controller and action.
we had to adjust config.ru
to make the relative root url work (prior to adding StimulusReflex)
# This file is used by Rack-based servers to start the application.
require_relative "config/environment"
map ActionController::Base.config.relative_url_root || "/" do
run Rails.application
end
Rails.application.load_server
currently we use a small monkey-patch to make it work with StimulusReflex.
class StimulusReflex::ReflexData
def url
url = data[:url].to_s
if ActionController::Base.config.relative_url_root
url.gsub(ActionController::Base.config.relative_url_root, "")
else
url
end
end
end
Describe the solution you'd like
would be nice if relative_root_url
is considered by StimulusReflex.
Additional context
nothing really to add
PR link
happy to send a PR if the monkey-patch is good enough :)
Metadata
Metadata
Assignees
Labels
No labels