Skip to content
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

[Bug]: middleware strapi::public strange example #2324

Open
hugzenfeu opened this issue Dec 16, 2024 · 2 comments
Open

[Bug]: middleware strapi::public strange example #2324

hugzenfeu opened this issue Dec 16, 2024 · 2 comments
Assignees

Comments

@hugzenfeu
Copy link

Link to the documentation page or resource

https://docs.strapi.io/dev-docs/configurations/middlewares#public:~:text=any%20configuration%20options.-,public,The,-public%20middleware%20is

Describe the bug

the only option listed is not in the example of implementation and doesn't seem to work in my installation of strapi (witch is not up to the last realese of V5)
I infer that it should look like that in config/middlewares.ts:

  {
    name: 'strapi::public',
    config: {
      maxAge: 86400000 // 1 day in milliseconds
    },
  },

but for me it does not work
I have no clue what should i do

Additional context

No response

Suggested improvements or fixes

No response

Related issue(s)/PR(s)

No response

@pwizla
Copy link
Collaborator

pwizla commented Dec 16, 2024

Hi @hugzenfeu!
Sorry you're having trouble with this.

The public middleware is based on koa-static and indeed the docs might be slightly outdated. Looking at the available configuration options for koa-static, maybe maxAge should be used as maxage? 🤔 By the way the example is just to give you an idea of what you could use (given all the options available in koa-static), but I agree it might look inconsistent with the table.
I'll check with Strapi core engineers and get back to you.

@hugzenfeu
Copy link
Author

Hi @pwizla ,
Thanks a lot, I m a little lost on this one

@pwizla pwizla self-assigned this Dec 17, 2024
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

No branches or pull requests

2 participants