openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Proxy POST requests for deprecated endpoints in dev env

Open bhardwajparth51 opened this issue 8 months ago • 1 comments

Problem

When a deprecated web.py endpoint receives a POST request in the local dev environment, it fails because the 303 redirect doesn't preserve the request body and headers. This affects any POST request to a deprecated endpoint, currently breaking the "set yearly reading goal" feature on localhost.

Reproducing the bug

  1. Start the local dev environment with make git && docker compose up -d
  2. Send a POST request to a deprecated endpoint:
curl -i -X POST http://localhost:8080/reading-goal.json \
  -d '{"year":2024}' \
  -H "Content-Type: application/json"
  1. Observe that the request fails — the 303 redirect drops the POST body and headers

Expected behavior: POST requests to deprecated endpoints should be forwarded to the fast_web container and return the correct response. Actual behavior: POST requests fail because the 303 redirect drops the request body and headers, causing the request to not reach the fast_web container correctly.

Context

  • OS: Linux
  • Environment: (dev/local)
  • The fast_web container is accessible internally via http://fast_web:8080
  • GET requests to deprecated endpoints work correctly via redirect

Breakdown

Implementation Details (for maintainers)

Requirements Checklist

  • [ ]

Related files

Stakeholders

@RayBB


Instructions for Contributors

  • Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

bhardwajparth51 avatar Mar 18 '26 09:03 bhardwajparth51

Note: this is blocking: https://github.com/internetarchive/openlibrary/pull/11895

RayBB avatar Mar 23 '26 17:03 RayBB