Skip to content

Method Not Allowed (405) when selecting a previous FAQ revision in admin editor (POST sent to GET-only route /admin/faq/edit/{id}/{lang}) #4547

Description

@nugatritter

Description

When editing an existing FAQ entry in the admin backend and clicking on one of the previous article versions/revisions (shown in the top-left area of the FAQ editor), the request fails with 405 Method Not Allowed instead of loading the selected revision into the editor.

Environment

  • phpMyFAQ version: 4.1.7
  • PHP version: 8.3.31
  • Web server: Apache/2.4.67 (Debian)
  • Deployment: Docker/Podman container (official image), reverse proxy not involved in this request path
  • Affected URL pattern: /admin/faq/edit/{id}/{lang} (example: /admin/faq/edit/46/de)

Steps to Reproduce

  1. Log in to the admin backend.
  2. Go to Content > Edit FAQs and open an existing FAQ entry for editing.
  3. In the editor, click on one of the previous article versions/revisions listed in the top-left area.
  4. Observe the error.

Expected Behavior

Clicking a previous revision should load that revision's content into the editor.

Actual Behavior

The browser shows:
POST http:///admin/faq/edit/46/de
[HTTP/1.1 405 Method Not Allowed]

Diagnosis

I compared GET and POST requests to the same URL manually:

GET request:
curl -i http:///admin/faq/edit/46/de

Result: 302 Found, redirecting to ./login (expected, since curl has no valid session cookie — this confirms the route accepts GET and is processed normally).

POST request (as sent by the revision link in the editor):
curl -i -X POST http:///admin/faq/edit/46/de

Result: 405 Method Not Allowed, returned immediately, before any authentication check.

This strongly suggests that the route /admin/faq/edit/{id}/{lang} is only registered for the GET method in the new Symfony routing (introduced in 4.1.0 — "added Symfony Routing for administration backend"), while the frontend element for selecting a previous revision incorrectly sends a POST request to this URL instead of a GET request.

Suggested Fix

Either:

  • change the revision-selector link/button in the FAQ editor template to perform a GET request (e.g. as a plain link or a form with method="get"), or
  • register the /admin/faq/edit/{id}/{lang} route to also accept POST, if a POST-based submission is intended here.

Additional Notes

This appears to be a regression introduced with the switch to Symfony Routing in the admin backend (4.1.0), since the older admin/index.php?action=editentry based URLs did not enforce a specific HTTP method per route.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions