Closed smlparry closed 4 years ago
Hi @smlparry thanks for opening up the PR here...
Let me see if i understand this correctly...
You are using nginx to send browser traffic to trainer.fitterapp.local
to the trainer.fitterapp.local/admin
route within the rails app.
Is this so you can nest admin based routes/resources in the /admin namespace within Rails?
And then also you don't want the user to see /admin
in the url?
Thats exactly right :)
i see... wouldn't this condition still exist without using inertia? for example, a theoretical update action with standard, non-inertia Rails code:
def update
@thing = Thing.find(params[:id])
if @thing.update(thing_params)
redirect_to admin_thing_path(@thing)
else
render :edit
end
end
will redirect the user to http://trainer.fitterapp.local/admin/things/:thing_id
right?
Closing because we don't think this is something inertia should be responsible for given that the same shortcomings exist in rails. Feel free to re-open (or add an issue) if we're mistaken!
Hey there 👋
I ran into an issue with Inertia that I think could be fixed quite easily. I'm using nginx to reverse proxy my subdomain to a nested route in Rails, the configuration looks like this:
Which causes Inertia to rewrite the current path to
/admin
rather than just/
Ive managed to fix this by setting a before action in my controller as such:
And this works correctly:
It seemed easy enough to add this as a configuration option to the Rails gem and I would imagine it being set in the initializer
FYI I havn't tested this code, but I hope it illustrates the point :)