-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19270 from strapi/v5/clean-root-url
chore: remove default index page from public middleware
- Loading branch information
Showing
8 changed files
with
37 additions
and
184 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { defaultsDeep } from 'lodash/fp'; | ||
import koaStatic from 'koa-static'; | ||
import type { Strapi, Common } from '@strapi/types'; | ||
|
||
type Config = koaStatic.Options; | ||
|
||
const defaults = { | ||
maxAge: 60000, | ||
}; | ||
|
||
export const publicStatic: Common.MiddlewareFactory = ( | ||
config: Config, | ||
{ strapi }: { strapi: Strapi } | ||
) => { | ||
const { maxAge } = defaultsDeep(defaults, config); | ||
|
||
strapi.server.routes([ | ||
{ | ||
method: 'GET', | ||
path: '/', | ||
handler(ctx) { | ||
ctx.redirect('/admin'); | ||
}, | ||
config: { auth: false }, | ||
}, | ||
// All other public GET-routes except /uploads/(.*) which is handled in upload middleware | ||
{ | ||
method: 'GET', | ||
path: '/((?!uploads/).+)', | ||
handler: koaStatic(strapi.dirs.static.public, { | ||
maxage: maxAge, | ||
defer: true, | ||
}), | ||
config: { auth: false }, | ||
}, | ||
]); | ||
}; |
Binary file removed
BIN
-13.9 KB
packages/core/core/src/middlewares/public/assets/images/group_people_1.png
Binary file not shown.
Binary file removed
BIN
-13.8 KB
packages/core/core/src/middlewares/public/assets/images/group_people_2.png
Binary file not shown.
Binary file removed
BIN
-14.2 KB
packages/core/core/src/middlewares/public/assets/images/group_people_3.png
Binary file not shown.
Binary file removed
BIN
-6.96 KB
packages/core/core/src/middlewares/public/assets/images/logo_login.png
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.