mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
fix(routing): don't check headers for prenredered pages (#12302)
This commit is contained in:
parent
4e9a3ac0bd
commit
7196c244ea
2 changed files with 10 additions and 1 deletions
5
.changeset/gentle-scissors-bow.md
Normal file
5
.changeset/gentle-scissors-bow.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes an issue where the origin check middleware run for prendered pages
|
|
@ -20,7 +20,11 @@ const FORM_CONTENT_TYPES = [
|
|||
*/
|
||||
export function createOriginCheckMiddleware(): MiddlewareHandler {
|
||||
return defineMiddleware((context, next) => {
|
||||
const { request, url } = context;
|
||||
const { request, url, isPrerendered } = context;
|
||||
// Prerendered pages should be excluded
|
||||
if (isPrerendered) {
|
||||
return next();
|
||||
}
|
||||
const contentType = request.headers.get('content-type');
|
||||
if (contentType) {
|
||||
if (FORM_CONTENT_TYPES.includes(contentType.toLowerCase())) {
|
||||
|
|
Loading…
Reference in a new issue