Skip to content

feat: support signed URL patterns without route lookup#129

Open
0xtlt wants to merge 2 commits into
adonisjs:9.xfrom
0xtlt:feat/signed-url-disable-route-lookup
Open

feat: support signed URL patterns without route lookup#129
0xtlt wants to merge 2 commits into
adonisjs:9.xfrom
0xtlt:feat/signed-url-disable-route-lookup

Conversation

@0xtlt

@0xtlt 0xtlt commented Jul 6, 2026

Copy link
Copy Markdown

🔗 Linked issue

Discussion: https://github.com/orgs/adonisjs/discussions/5126

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR adds support for generating signed URLs from route patterns without performing a route lookup.

It restores the disableRouteLookup behavior for the typed signedUrlFor helper, matching the legacy router.makeSignedUrl(..., { disableRouteLookup: true }) API.

Example:

signedUrlFor('/files/:key', { key: 'invoice.pdf' }, {
  disableRouteLookup: true,
  prefixUrl: 'https://example.com',
  qs: {
    download: true,
  },
})

When disableRouteLookup is enabled, the first argument is parsed as a route pattern and signed directly. Regular signedUrlFor calls still use route lookup and keep their existing route-name type safety.

This also adds runtime and type-level coverage for the new behavior.

Docs PR: adonisjs/v7-docs#67

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Comment thread src/router/signed_url_builder.ts Outdated
...[identifier, params, options]
const signedRoute: SignedUrlFor<Routes> = function route(
identifier: string,
params?: any[] | Record<string, any>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make the params type-safe too by using the https://github.com/poppinss/types/blob/1.x/src/route.ts#L50 from the types package

@thetutlage thetutlage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me!

@0xtlt

0xtlt commented Jul 8, 2026

Copy link
Copy Markdown
Author

@thetutlage Done, I used InferRouteParams for the pattern params.

Does it look good now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants