Next.js Discord

Discord Forum

400 Bad Request Public Subfolder Images

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
I am getting 400 bad requests from images in my public subfolder.

folder structure
public/
    images/
       placeholdetr.png


Error:
 http://localhost:3000/_next/image?url=%2Fimages%2Fplaceholder.png&w=640&q=75 400 (Bad Request)


Surprisingly , What I see is
if I link Image present directly in public folder then no issue ,(path relative to public : /dkdskdks.png)

but if i try link image present in subfolder of the public then there is issue (path relative to public folder is : /images/xnsxsx.png)

I have middleware changes
Matcher is as below

export const config = {
  matcher: [
    /*
     * Match all paths except for:
     * 1. /api routes
     * 2. /_next (Next.js internals)
     * 3. /_static (inside /public)
     * 4. all root files inside /public (e.g. /favicon.ico)
     */
    "/((?!api/|_next/|_static/|_vercel|[\\w-]+\\.\\w+).*)",
  ],
};

0 Replies