Proxyman
Proxyman copied to clipboard
Scripting Tool turning 304 responses into 200 with non-empty body
Description
When using the Scripting Tool to forward requests to a local server, the request with status code 304 before forwarding will become 200, with a strange non-empty body, causing the browser failed to execute javascript code.
Steps to Reproduce
- Start a local http dev server.
- Enable system proxy in Proxyman (or using SwitchyOmega in a browser).
- Use Scripting Tool to redirect http requests (from https://example.com to http://localhost:8080).
- If local dev server returns 304 Not Modified, the browser may receives 200 OK with a strange body:
0
HTTP/1.1 304 Not Modified
Access-Control-Allow-Origin: *
Content-Type: application/javascript; charset=utf-8
Accept-Ranges: bytes
ETag: W/"182a1-eQ3lKViLjXY/D1cwx5lSaWKT2Io"
Content-Encoding: gzip
Date: Thu, 14 Dec 2023 07:05:26 GMT
Connection: keep-alive
Keep-Alive: timeout=5
transfer-encoding: chunked
0
Current Behavior
Response header received in Chrome (should be 304 Not Modified):
Response body received in Chrome (should be empty):
Corresponding request in Proxyman:
Script using in Proxyman:
Expected Behavior
Chrome received 304 Not Modified with an empty body, just as before it was forwarded.
Environment
- App version: Proxyman 4.14.0 (49500)
- macOS version: macOS Sonoma
Look like Chrome returns 304 because the cache is hit.
Can you add these response Header (from the No Caching Tool): https://docs.proxyman.io/advanced-features/no-caching#3.-how-it-works ?
It forces the Google Chrome to get the real data instead of using the cache.
There's no issue if I enable "No Caching" in Proxyman or enable "Disable cache" in Chrome DevTools. But my questions is where does this strange body came from?
0 HTTP/1.1 304 Not Modified Access-Control-Allow-Origin: * Content-Type: application/javascript; charset=utf-8 Accept-Ranges: bytes ETag: W/"182a1-eQ3lKViLjXY/D1cwx5lSaWKT2Io" Content-Encoding: gzip Date: Thu, 14 Dec 2023 07:05:26 GMT Connection: keep-alive Keep-Alive: timeout=5 transfer-encoding: chunked 0
Look like it's not from Proxyman. It's from the Google Chrome.