swagger-api / validator-badge

Validate your Swagger JSON/YAML today!
http://swagger.io
Apache License 2.0
210 stars 85 forks source link

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

Open MikeRalphson opened 8 years ago

MikeRalphson commented 8 years ago

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.

webron commented 8 years ago

Can you provide more context please?

MikeRalphson commented 8 years ago

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

webron commented 8 years ago

Got it, thanks for the explanation.

dgrechka commented 8 years ago

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

MikeRalphson commented 8 years ago

@dgrechka Many thanks, will try it out.

MikeRalphson commented 6 years ago

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