Fix: Prevent request deauthorization when loading assets #641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the problem described in Issue #613, where requests to the
/assets/
directory caused the__profilin
cookie to be deleted, which in turn deactivated the client-side profiler.Changes Made
Prevent Cookie Deletion:
handle_cookie
method to stop cookie deletion for asset requests by usingpreserve_cookie: true
. This keeps the profiler's state when loading assets.Skip Asset Requests:
Rack::MiniProfiler.config.skip_paths = ['/assets']
to ignore asset requests during profiling checks. This is important because requests to/assets
can still happen even ifRails.config.public_file_server.enabled
isfalse
.config.assets.unknown_asset_fallback
option allows fallback handling, which can lead to extra requests to/assets
. These paths were not fully considered in the dynamic skip paths configuration.Rails Version Handling:
public_file_server.enabled
andunknown_asset_fallback
.With these changes, the unwanted cookie deletion that caused the error
ActionController::RoutingError (No route matches [POST] "/mini-profiler-resources/results")
no longer happens.