-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Update auth config to allow authorized images (#400) #422
Update auth config to allow authorized images (#400) #422
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Tyler98ky is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Had same issue. Adding @tylerhoward15's code fixed broken images |
It works for me! |
const protectedPaths = ['/dashboard', '/customers', '/invoices']; | ||
const isProtectedPath = protectedPaths.some((path) => | ||
nextUrl.pathname.startsWith(path), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tylerhoward15, thank you for the contribution. This was resolved in this PR: #355
Are you still seeing broken images? I'm not able to reproduce.
In either case:
- The protected pathname starts with
/dashboard
. E.g./dashboard/customers
. SostartsWith
would evaluate tofalse
for/customers
. - I think it's slightly better practice to protect a route higher up (
/dashboard
), so that if we add or change the name of a child segment, they'd automatically be protected.
Hey @delbaoliveira, thanks for checking in on this! When I first encountered this issue and opened this PR (November 9th), #355 appears to have already been merged (November 3rd). However, myself and a few others were definitely still having assets not loading. During troubleshooting, I logged out the However, I just pulled a copy of the latest changes to the repo, and tested locally and deployed to Vercel adding logs again, and those requests all seem to be prefixed properly now! I am however still seeing 302 redirects for the So it seems as though maybe there was a bug where the application wasn't prefixing requests properly with dashboard, but that has since been resolved since this issue was opened. That seems the most likely scenario to me, but just to clarify, there were still issues after #355 for some of us at least. As for the |
Glad this is resolved 😌
Thank you, I'll look into the I'm sure there are projects where people haven't updated and might still be seeing this issue. Since I'm not able to reproduce in the latest, I'll close the PR for now, thank you for bringing it up. Appreciate it! |
#400
Customer images were not loading after adding auth. This was because authorized requests were only allowed if they came from the
/dashboard
route. However, when fetching customer images, they were requested from the route/customers
.So by adding a list of protected urls, we ensure they're all available when logged in, and they're inaccessible when not logged in.