CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 20:15:01 GMT
content-type: text/html; charset=utf-8
cache-control: no-cache
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com github.githubassets.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com marketplace-screenshots.githubusercontent.com/ copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
referrer-policy: no-referrer-when-downgrade
server-timing: pull_request_layout-fragment;desc="pull_request_layout fragment";dur=361.213534,conversation_content-fragment;desc="conversation_content fragment";dur=844.887748,conversation_sidebar-fragment;desc="conversation_sidebar fragment";dur=430.976563,nginx;desc="NGINX";dur=1.244407,glb;desc="GLB";dur=139.576401
strict-transport-security: max-age=31536000; includeSubdomains; preload
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-content-type-options: nosniff
x-frame-options: deny
x-voltron-version: aab62e3
x-xss-protection: 0
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=zLaU%2FQoc%2F2rQFLX5e3F8A7UuYw7Xd5NecMR%2BWLkz3fTyYjIT%2Ftkp32nd0%2BxpQjWclUtn1oMCfkhXBdoS2kFuP6gI1cmH5rr%2FadIfKSqVbT%2FT4lSUBYJ76ZldG5fE3o9bzWD2Eh3zQWsv%2FD6HzJiE0uqvMyMyh17difDucQ0IMCGFItnkW54CB6SO%2F9wy0bEf6sAHtXUMIhM27ed532DGPs75bpQeokOmHCY%2BrqeqBues0XLZMHgxZgwOswPQEiJTW5GLowkL4ghPr4xPXOZvrQ%3D%3D--%2B%2BOy%2Fxv%2BcHswLTUh--mM9SuC%2B%2FbiBfnxTT2l2YiQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1176866408.1760213700; Path=/; Domain=github.com; Expires=Sun, 11 Oct 2026 20:15:00 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 11 Oct 2026 20:15:00 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: A828:160A71:9C3886:CDD81A:68EABAC4
Fix `SCRIPT_NAME` handling in URL helpers for root-mounted engines by flavorjones · Pull Request #55668 · rails/rails · GitHub
Fix
Fix
flavorjones
force-pushed
the
flavorjones/fix-script-name-in-root-mounted-engine
branch
from
September 13, 2025 19:17
flavorjones
force-pushed
the
flavorjones/fix-script-name-in-root-mounted-engine
branch
from
September 15, 2025 12:06
flavorjones
force-pushed
the
flavorjones/fix-script-name-in-root-mounted-engine
branch
from
September 15, 2025 12:09
flavorjones
deleted the
flavorjones/fix-script-name-in-root-mounted-engine
branch
September 19, 2025 20:51
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 22k
Fix SCRIPT_NAME
handling in URL helpers for root-mounted engines
#55668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jeremy
merged 1 commit into
rails:main
from
flavorjones:flavorjones/fix-script-name-in-root-mounted-engine
Sep 16, 2025
Merged
Fix SCRIPT_NAME
handling in URL helpers for root-mounted engines
#55668
jeremy
merged 1 commit into
rails:main
from
flavorjones:flavorjones/fix-script-name-in-root-mounted-engine
Sep 16, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7d4325d
to
b780f4e
Compare
Thanks for catching my bug @flavorjones! I completely forgot the context at this point but one thing I can tell you: trailing slashes always get on my way! |
b780f4e
to
a44cc66
Compare
Related to changes introduced in rails#29898
a44cc66
to
ba3d32e
Compare
jeremy
approved these changes
Sep 16, 2025
This was referenced Sep 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
You can’t perform that action at this time.
Motivation / Background
When an engine is mounted at "/" and
SCRIPT_NAME
is being used, the URL helpers incorrectly drop the script name from the generated URLs.Detail
The issue is in the private method
ActionDispatch::Routing::RoutesProxy#merge_script_names
which doesn't handle the edge case ofnew_script_name
being a sole slash "/" with no segment following it.This bug does not manifest for non-root paths with trailing slashes (like "/bar/") because the paths are cleaned up by
Mapper::Mapping#normalize_path
inMapper::Resources.add_route
.The fix I've adopted here is simply to remove any trailing "/" from the
new_script_name
variable. We could also just returnprevious_script_name
ifnew_script_name == "/"
, however I thought running the names through the existing logic would be preferable to a special-case guard clause.Additional information
I think this issue has been present since the changes introduced in #29898 in Rails v5.2.0. cc @deivid-rodriguez in case he has feedback! 🙏
I think this might fix #34023. cc @jeremy in case he remembers what was going on there.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]