SpaceApi/website

directory.spaceapi.io has wrong content type and missing CORS headers

Closed this issue · 2 comments

directory.spaceapi.io serves the wrong content type:

% http -h https://directory.spaceapi.io 
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Date: Tue, 21 May 2019 19:14:51 GMT
Transfer-Encoding: chunked
Vary: Origin

Compare it with https://spaceapi.fixme.ch/directory.json

% http -h https://spaceapi.fixme.ch/directory.json
HTTP/1.1 200 OK
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Cache-Control: no-cache
Content-Length: 10383
Content-Type: application/json
Date: Tue, 21 May 2019 19:19:01 GMT
ETag: "453735789"
Last-Modified: Sun, 19 May 2019 21:30:07 GMT
Server: lighttpd/1.4.35
Strict-Transport-Security: max-age=31536000
gidsi commented

For CORS header you have to add an origin, like this

curl -vvvv https://directory.spaceapi.io/ -H "Origin: http://example.com" 
> GET / HTTP/2
> Host: directory.spaceapi.io
> User-Agent: curl/7.64.1
> Accept: */*
> Origin: http://example.com

< HTTP/2 200 
< access-control-allow-origin: *
< content-type: text/plain; charset=utf-8
< date: Tue, 21 May 2019 19:45:59 GMT
< vary: Origin

Apparentyl I completely forgot to set the right content type, going to fix it.

gidsi commented

Apparentyl I completely forgot to set the right content type, going to fix it.

Fixed in 3e989e7806d44376aa6ba5baaf47f2098380b267