validator-badge icon indicating copy to clipboard operation
validator-badge copied to clipboard

Image served without a content-type header is breaking github's cache

Open MikeRalphson opened this issue 8 years ago • 6 comments

You can see the effect of this in the project's own README.

See https://help.github.com/articles/why-do-my-images-have-strange-urls/ for further information.

MikeRalphson avatar Mar 07 '16 17:03 MikeRalphson

Can you provide more context please?

webron avatar Mar 07 '16 17:03 webron

Sorry. The online swagger validator-badge at swagger.io is serving PNG images with no content-type header:

curl -i http://online.swagger.io/validator?url=https%3A%2F%2Fraw.githubusercontent.com/Mermade/bbcparse/master/nitroApi/swagger.json
HTTP/1.1 200 OK
Date: Mon, 07 Mar 2016 17:37:57 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type
Cache-Control: no-cache
Server: Jetty(9.2.9.v20150224)
Transfer-Encoding: chunked

This mean's Github's image cache (camo) is failing to cache the image and is returning a broken image link, as per the link in my initial issue.

You can see the effect of this in the swagger validator github project's README here: https://github.com/swagger-api/validator-badge/#swagger-validator-badge

and in my wiki sidebar here: https://github.com/Mermade/bbcparse/wiki

MikeRalphson avatar Mar 07 '16 20:03 MikeRalphson

Got it, thanks for the explanation.

webron avatar Mar 08 '16 00:03 webron

I've created a temporal workaround. Script that proxies requests to http://online.swagger.io/validator/ and adds "Content-Type: image/png" header to the response so that camo proxy passes it

You can use it if you want until this issue is fixed. Just query http://dgrechka.net/swagger_validator_content_type_proxy.php instead of http://online.swagger.io/validator/.

E.g.

http://dgrechka.net/swagger_validator_content_type_proxy.php?url=https://raw.githubusercontent.com/dgrechka/FetchClimateAPI/master/RegularUserAPI.yaml

dgrechka avatar Apr 22 '16 20:04 dgrechka

@dgrechka Many thanks, will try it out.

MikeRalphson avatar Apr 24 '16 11:04 MikeRalphson

Looks like this was fixed in 689ffa80, though not released yet?

MikeRalphson avatar Jun 28 '18 13:06 MikeRalphson