When an HTTP route goes to a rails engine, the router modifies the environment before passing it downstream. Since we're using the router to resolve the normalized path, in this case the environment could have been modified before rails stack actually got to see it, preventing it from routing the request correctly.
Using a clone of the environment to match the route prevents this problem, ensuring Rails stack gets an unmodified environment to do its own routing on it again. This fixes #329
This PR also fixes another problem I've found while trying to fix this.
When an HTTP route goes to a rails engine, the router modifies the environment before passing it downstream. Since we're using the router to resolve the normalized path, in this case the environment could have been modified before rails stack actually got to see it, preventing it from routing the request correctly.
Using a clone of the environment to match the route prevents this problem, ensuring Rails stack gets an unmodified environment to do its own routing on it again. This fixes #329
This PR also fixes another problem I've found while trying to fix this.