[5.1] SEF: Don't redirect for documents other than HTML #43083
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of Changes
With the new options to improve the routing, we introduced redirects when the URL does not meet our expectations. These redirects only take effect when the request is for a frontend page and when it is a GET request. However this also means that for example AJAX calls or calls to JSON/XML output gets redirected. This isn't an issue because GET requests do automatically follow redirects, but it would mean that such a request would be received, redirected and then received again, thus creating 2 requests on the server. In order to reduce load, this PR thus excludes all requests which aren't for HTML documents.
Testing Instructions
/?format=feed
to the URLActual result BEFORE applying this Pull Request
You get redirected to the URL without the trailing slash and then receive the feed.
Expected result AFTER applying this Pull Request
You get the feed output directly without a redirect.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed