browserless icon indicating copy to clipboard operation
browserless copied to clipboard

Sending an explicit Accept header to /function results in 404

Open simonc opened this issue 9 months ago • 0 comments

Describe the bug When using the chromium:v2.27.0 image in Docker, the /function endpoint returns a 404 when an Accept header is sent.

To Reproduce Steps to reproduce the behavior:

  1. Deploy ghcr.io/browserless/chromium:v2.27.0 image in Docker
  2. Send a cURL request as defined below with Accept: application/json header
  3. Get a 404 response
  4. Send the same cURL request with an Accept: */* header
  5. Get a 200 response
curl 'http://localhost:3000/function?token=XXX' \
  -X POST \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/javascript' \
  -d'
    export default async function ({ page }) {
      return {
        data: { key: "value" },
        type: "application/json"
      };
    };
  '

Expected behavior The request should be accepted and the response should be correct with a 200 OK code.

Additional context The logs indicate the following:

browserless.io:server:trace  Handling inbound HTTP request on "POST: /function?token=XXX" +3m
browserless.io:server:error  No matching HTTP route handler for "POST: http://0.0.0.0:3000/function?token=XXX&launch=%7B%7D" +3m

simonc avatar Apr 07 '25 19:04 simonc