GithubHelp home page GithubHelp logo

Comments (9)

laurilehmijoki avatar laurilehmijoki commented on June 3, 2024

Please provide a detailed description of the problem.

from s3_website.

chonthu avatar chonthu commented on June 3, 2024

Users don't have the ability to state the content type when deploying files. When a website gets deployed, proper response headers are not sent. Browsers and servers use this data to figure our proper encoding, languages, etc.

Example from sdk docs:

amazon_bucket.objects.each do |ob|
metadata = ob.metadata
content_type = "UTF-8"
ob.copy_to(ob.key, :metadata{:foo => metadata[:foo]}, :content_type => content_type)
end

from s3_website.

laurilehmijoki avatar laurilehmijoki commented on June 3, 2024

I'm sorry but I don't understand how the thing you are saying relates to this gem. Can you be more specific?

from s3_website.

chonthu avatar chonthu commented on June 3, 2024

I don't understand what part your confused about. Every website sends header response data. Your deploy gem does not set these proper headers onto the files being deployed. Each file has the ability to store "metadata". Please re-read my last comment as I showed you an example of what amazon s3 library does to set the metadata on the files.

from s3_website.

chonthu avatar chonthu commented on June 3, 2024

Response headers from a site deployed with your gem:
screen shot 2013-07-18 at 8 20 42 am

Response headers from a site like google.com:
screen shot 2013-07-18 at 8 21 04 am

from s3_website.

laurilehmijoki avatar laurilehmijoki commented on June 3, 2024

s3_website infers the content-type header from the file extension. Here's the code:

opts[:content_type] = "text/html; charset=utf-8" if mime_type == 'text/html'
. The mime-types gem provides the inference code.

Try debugging the code above. Maybe you will find the reason why s3_website does not set the content-type correctly for you.

from s3_website.

edwardball avatar edwardball commented on June 3, 2024

@chonthu I've been wondering about this for a while. I think what is happening is this...

Basically, if the requested object is same as the cached copy held by the client, then instead of a 200 OK status, (like your google example), you'll actually get a 304 Not Modified status (like the first response header you posted). Give this a try: do a hard refresh on one of your web pages (Command-Shift-R). This will delete your cache and the server will resend the file, and you should now see the correct Content-Type header.

Relevant AWS docs here: http://docs.aws.amazon.com/AmazonS3/latest/dev/CustomErrorDocSupport.html

from s3_website.

laurilehmijoki avatar laurilehmijoki commented on June 3, 2024

Closing this as "will not fix".

from s3_website.

DevoKun avatar DevoKun commented on June 3, 2024

I had the same problem. The Content-Type for all my .html files uploaded by s3_website were being set to: application/xhtml+xml

For me, the problem was that the mime-type was being detected as xml instead of html. I was able to fix my problem by changing my Jekyll layout from:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr" lang="en">

to:

<!DOCTYPE html>
<html>

from s3_website.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.