apostrophecms / apostrophecms/apostrophe

ERR_HTTP_HEADERS_SENT error when visiting parked pages ending with forward slash

Open
#3,554 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## To Reproduce
As discussed in https://discord.com/channels/517772094482677790/701815369005924374/912684621043486770

I created a piece page type and piece – article-page and article. It’s a blog with articles. It’s been parked at the url /spravy. When I create a new article and select publish and view I get redirected to the article http://localhost:3000/spravy/new-article which is fine. Also when you visit the parked page without the forward slash at the end it works fine. But when you visit parked page and leave a forward slash at the end http://localhost:3000/spravy/ the server crashes and I get ERR_HTTP_HEADERS_SENT.

Step by step instructions to reproduce the behavior:
I'm sharing a simple test project here to that reproduces the issue.
https://github.com/Miselrkba/apos-http-err
Visit http://localhost:3000/spravy/ and the server will crash.

**Screenshots**
*If applicable, add screenshots to help explain your problem.*
![http-headers-error](https://user-images.githubusercontent.com/68853293/143192429-400442d1-127d-49e4-bfdb-63dd35522712.png)

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction project, then visit http://localhost:3000/spravy/ and compare it with the working URL without the trailing slash. Trace the request handling for the parked page and determine why the server sends headers more than once; done means the trailing-slash URL no longer crashes and the parked page responds normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.