-
-
Notifications
You must be signed in to change notification settings - Fork 213
This PR changes ensures that some schema files have the correct content type #32
Conversation
…nt-type. I did this simply by renaming files like /card to /card.json. I also used the `redirect_from` github plugin so that people who are already linking to the old url will redirect to the new url.
Brilliant. Thankyou so much. I haven't looked into jelky... hardly at all to be honest. |
@awwright How do you go about testing Jekyll locally? (I ask you mainly because I really don't have the time to investigate) |
Hi @Relequestual , It's called Jekyll (as in Jekyll and Hide) and the easiest way to run it is something like:
|
The existing URLs have to send a 200 and not a redirect, is this going to On Oct 3, 2016 06:17, "Evert Pot" [email protected] wrote:
|
Yes, unfortunately. Jekyll is not a webserver, it just generates a bunch of HTML files. The only real redirect it has to it's disposal is a html-based redirect via I think ideally the urls wouldn't even change in this case, but just have their headers set correctly. But none of these things are options when you use Jekyll. This, to me, seemed like the "most sane" solution, but it's still not ideal. |
@evert Never remember the name correctly. Thanks. =] |
@Relequestual Well, theoretically, it shouldn't be a problem... but it's not ideal. In practice redirects have caused me a lot of problems (either I forgot to support them like I should or other people don't). Honestly I don't know what's best here. If we're going to talk about what the files should be served as, again, it's Someone tell GitHub they shouldn't be relying on file extensions? I don't think they intend their website tool for anything but HTML documentation. |
GitHub pages / Jekyll serves static files. They don't have a lot to go off other than file extensions. |
@evert Yeah, it just seems GitHub is being a little weak though, since Apache has supported serving static files with whatever Content-Type you want since forever. Ideally, we would be able to do some sort of Content-Type Negotiation: http://httpd.apache.org/docs/2.4/content-negotiation.html I have half a mind to see if I could whip something up on SourceForge.net, who offers full Apache. |
It's kind of a core tennet of Jekyll though. You can serve the product of the Jekyll process also from a local filesystem. If you need something slightly more advanced you're probably better off on a different host, yea. |
-1 on SourceForge.net. They bundle adware in their downloads... doesn't feel like the sort of place we should go. |
@awwright @Relequestual also -1 on sourceforge here. It was a great site once but now it's an adware-infested backwater. |
What about a free-tier amazon instance? |
Well we wouldn't be hosting downloads on SourceForge, but AFAICT that was a one-time issue for some unofficial projects and with what they consider abandoned projects. AWS doesn't offer a free tier for EC2 (except the 12 month one), though I wouldn't want to have to build a server anyways. AWS Lambda allows a million requests a month, but that likely also includes website assets. Best case, that's one request every 2.6 seconds. AWS S3 doesn't have a free tier, but allows you to set the media type (Content-Type) of files, and would likely be <$5/mo. I can also offer my own server, but that seems too centralized. |
I'm reluctant to host this elsewhere to try and get round the issue. I also do not want to run another server. |
@evert Would a Gemfile and using bundler be preferable to making sure people |
I'm not sure if I should comment here or #31, which seems to be what this is trying to fix. Since content is spread over both, I will briefly summarize my understanding here, since I am not entirely sure what is blocking it.
While depending on preferences, some variations on this existing PR could be made, overall it seems like it would be an improvement. My thoughts on the concerns I remember reading: MIME-type is not "application/schema+json"
Has any consideration been given to a file extension for JSON Schema files? If they had a distinct file extension, that is way you could get the MIME-type correct on GitHub Pages. HTTP Redirect not possible
This seems unlikely to me (though I could easily be wrong), but if the use case is that these resources exist primarily for machines, and it is important to demonstrate the correct MIME-type, then you will probably need another host. If this is the case, it is really more of a web service than a web site resource, and it might make sense to separate if from the website. The website could live on a static host, and you could probably get by efficiently with AWS Lambda since all you need to do is send a predetermined http response. |
@vossad01 I think you're right in your understanding. I forget why, but someone previously mentioned that HTTP redirect wouldn't be sufficient. @evert could you weigh in here? Was it just viewing in the browser that you found a problem with? |
I was trying to give some traction to this issue because it appears that an approved pull request by a first-time contributor has been blocked indefinitely on something largely unrelated to their requested change. This PR resolves #31 by @evert which discusses both the download behavior resulting from the invalid MIME-type as well as in-browser inspection behavior. Here is the comment you referenced by @awwright indicating dissatisfaction with the HTTP redirect. However, you have alternative options of 404-ing instead or keeping the existing resource as-is at the current location. |
@vossad01 I think fundamentally we're not going to put .json extensions (or any other extension) on the official URIs for meta-schemas. It should be possible for us to offer different representations (a likely example would be an We are going to have to solve the hosting problem at some point, unless someone can figure out how to tell GitHub the media type. |
If @Relequestual, @awwright and @Julian agree with me, it might be better to move the media type discussion over to an issue, and close this PR. @evert we really appreciate the work (and maybe the others will disagree with me and we'll work towards this), but I think we need to take a different approach. Which is complicated by the whole "the owner of the json-schema.org domain won't talk to us anymore" problem. |
No worries! |
We don't even know WHO has control of the json-schema.org domain name... just someone has to pay the bills (iirc it can be anyone), and it points to github control. It's a bit of a problem really =/ |
The docs are clear that you will not be able to achieve the functionality @handrews specifies using GitHub Pages. I do not really fault GitHub pages for that. Given this, I agree this should be closed. #31 should also be closed in favor of a new issue outlining the acceptable outcome, or at least #31 needs to be updated indicating the new direction. |
Closing based on apparent general agreement, discussion summarized for further work at issue #31. |
I did this simply by renaming files like /card to /card.json.
I also used the
redirect_from
github plugin so that people who arealready linking to the old url will redirect to the new url.