harttle/auto-cors

Missing response headers

faveoled opened this issue · 5 comments

AUTO_CORS_PORT=7777 npx auto-cors

GET http://localhost:7777/https://odrs.gnome.org/1.0/reviews/api/ratings

No headers in response even though original server serves them. (e.g. Content-Type)

Hey @faveoled, I can't repro. Could you try curl with -v argument? Here is what I see:

curl -v http://localhost:7777/https://odrs.gnome.org/1.0/reviews/api/ratings
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1:7777...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 7777 (#0)
> GET /https://odrs.gnome.org/1.0/reviews/api/ratings HTTP/1.1
> Host: localhost:7777
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: host,user-agent,accept
< date: Wed, 15 Feb 2023 12:40:33 GMT
< content-type: application/octet-stream
< content-length: 1407420
< last-modified: Wed, 01 Feb 2023 16:07:04 GMT
< etag: "63da8e28-1579bc"
< expires: Fri, 03 Mar 2023 16:38:49 GMT
< cache-control: max-age=2592000, public
< pragma: public
< x-accel-expires: @1677861530
< server: CDN77-Turbo
< x-77-nzt: AVm7uxJNoE3/Jz0SAA
< x-77-nzt-ray: 7c205423e4355f9dc1d2ec6374c51437
< x-cache: HIT
< x-age: 1195303
< x-77-pop: losangelesUSCA
< x-77-cache: HIT
< accept-ranges: bytes
< Connection: keep-alive
< Keep-Alive: timeout=5
...

Strange

curl -v http://localhost:7777/https://odrs.gnome.org/1.0/reviews/api/ratings
*   Trying 127.0.0.1:7777...
* Connected to localhost (127.0.0.1) port 7777 (#0)
> GET /https://odrs.gnome.org/1.0/reviews/api/ratings HTTP/1.1
> Host: localhost:7777
> User-Agent: curl/7.81.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Date: Wed, 15 Feb 2023 13:00:36 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked
< 
{
    "0ad.desktop": {
...

Original headers (curl -v https://odrs.gnome.org/1.0/reviews/api/ratings)

< HTTP/2 200 
< date: Wed, 15 Feb 2023 13:02:57 GMT
< content-type: application/octet-stream
< content-length: 1407420
< last-modified: Wed, 01 Feb 2023 16:07:04 GMT
< etag: "63da8e28-1579bc"
< expires: Fri, 03 Mar 2023 16:43:28 GMT
< cache-control: max-age=2592000
< pragma: public
< cache-control: public
< x-accel-expires: @1677861808
< server: CDN77-Turbo
< x-77-nzt: ASUTyiIIBpn/UUESAA
< x-77-nzt-ray: 1f31911e84026b4101d8ec635c97e615
< x-cache: HIT
< x-age: 1196369
< x-77-pop: moscow_6_RU
< x-77-cache: HIT
< accept-ranges: bytes

In logs it says 0 bytes for some reason:

GET https://odrs.gnome.org/1.0/reviews/api/ratings [0 bytes]

Access-Control-Allow-Headers is different in your sample from mine. (I'm not using any config with auto-cors)