shopware / shopware/shopware

Responses to product listing requests with invalid page numbers

Open
#11,682 0 comments 0 reactions 0 assignees View on GitHub
component/storefront domain/discovery Platform(Default) priority/low
Dominant language
PHP
Stars
3.4k
Forks
1.2k
Avg merge
2d 23h
Merged PRs (30d)
433

Description

### Technical TODO

Requesting a listing page with an invalid page number no longer causes strange results with https://github.com/shopware/shopware/issues/11116

Let's discuss if it would make sense to respond with 404 or a redirect if a listing page with an invalid number (negative number, zero or number above the total page number) is requested.

I think we should respond with 404 to zero and negative page numbers because they are logically invalid and will always be. Requesting with a page number higher then the total page number should lead to a redirect because this is more likely to be an accident or done by a poorly coded crawler. A 404 here might also mess up SEO (not an expert so correct me if I am wrong).

It might be possible to throw an expection (leading to a 404) early by evaluating the criteria before processing them. This would also save processing time. The evaluation if the requested page number is above the total page number requires the listing results and can therefore only be done at then end.

We should also discuss how empty listings are handled.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the related issue 11116 and the product listing request flow. Clarify the intended response for negative, zero, and out-of-range page numbers, including how empty listings should behave. The work is complete when these cases have an agreed, documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.