Skip to contentSkip to conversation

s3website 404 behaviour

DISCUSSION Abhishek Lekshmanan 2 participants 3 messages May 2, 2016

lore
Share & tools
lore
#0 lore raw

Hi

After setting up ceph.conf values resembling:

rgw dns name = myhost.domain.com (eg)
rgw enable static website = true
rgw dns s3website name = mywebsite.domain.com

and creating buckets and objects with public-read canned acls, via the following code (assume conn is s3connection object returned by boto):

website_bucket = conn.create_bucket("s3website",policy='public-read') index_key = website_bucket.new_key('index.html') index_key.content_type = 'text/html' index_key.set_contents_from_filename('index.html',policy='public-read')

error_key = website_bucket.new_key('error.html') error_key.content_type = 'text/html' error_key.set_contents_from_filename('error.html',policy='public-read')

foo_key = website_bucket.new_key('foo.html') foo_key.content_type = 'text/html' foo_key.set_contents_from_filename('foo.html',policy='public-read')

website_bucket.configure_website('index.html','error.html') website_bucket.get_website_configuration()

# returns
# {'WebsiteConfiguration': {'ErrorDocument': {'Key': 'error.html'}, 'IndexDocument': {'Suffix': 'index.html'}}}

Calling urls like s3website.mywebsite.domain.com works as expected, links from index page are processed correctly, and accessing something like s3website.<website-domain>/foo.html also works as expected.

However the behaviour when a 404 is encountered in the bucket seems erratic, for eg accessing:
s3website.mywebsite.domain.com/nonexistant.html

the browser sees a 200 OK and just does a download of an empty file, rgw actually returns a 404 here[1]. I haven't checked the behavior on S3 yet, Is there something else that needs to be set in bucket website configuration, or is this something RGW is doing wrong at the moment?

[1]: https://gist.github.com/theanalyst/891781582ddc454bafdc5ef7d075ec7a

--
Abhishek Lekshmanan
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

(I'm on the list, no need to mail me directly).

Quoted 5 lines · Abhishek Lekshmanan

the browser sees a 200 OK and just does a download of an empty file, rgw actually returns a 404 here[1]. I haven't checked the behavior on S3 yet, Is there something else that needs to be set in bucket website configuration, or is this something RGW is doing wrong at the moment? [1]: https://gist.github.com/theanalyst/891781582ddc454bafdc5ef7d075ec7a

What commits are you using?
You'll need both PR8633 and PR8669 present.

Signature · 4 lines
Robin Hugh Johnson
Gentoo Linux: Developer, Infrastructure Lead, Foundation Trustee
E-Mail     : [email protected]
GnuPG FP   : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
author
#2 lore raw
Quoted 10 lines · Robin H. Johnson

(I'm on the list, no need to mail me directly).

Quoted 5 lines · Abhishek Lekshmanan

the browser sees a 200 OK and just does a download of an empty file, rgw actually returns a 404 here[1]. I haven't checked the behavior on S3 yet, Is there something else that needs to be set in bucket website configuration, or is this something RGW is doing wrong at the moment? [1]: https://gist.github.com/theanalyst/891781582ddc454bafdc5ef7d075ec7a

What commits are you using?
You'll need both PR8633 and PR8669 present.

(already mentioned in irc, mentioning here for completeness)

Both of these PRs weren't yet there in the RGW I was using, I'll apply these and see how the behaviour is.

Thanks
Abhishek