Project

General

Profile

Actions

Bug #52363

open

rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static website

Added by XiangRui Meng over 2 years ago. Updated 7 months ago.

Status:
Pending Backport
Priority:
Normal
Assignee:
Target version:
-
% Done:

0%

Source:
Tags:
website backport_processed
Backport:
pacific quincy reef
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Suppose the rgw website instance's domain name is objects-website-region.domain.com, then I curl the domain name, it will return as follows.

curl http://objects-website-region.domain.com
<html>
 <head><title>404 Not Found</title></head>
 <body>
  <h1>404 Not Found</h1>
  <ul>
   <li>Code: NoSuchBucket</li>
   <li>RequestId: tx000000000000000000002-00612025dd-3529e9-default</li>
   <li>HostId: 3529e9-default-default</li>

I find the html page is incomplete, it lacks </ul>, </body> and </html> symbol. This happens because the Content-Length in response header only counts the above page size, then the whole response header is sent to client. Next, in rgw flushes formatter, the above three missing html symbols are supplemented in html page before rgw sends response body to client. The Content-Length is less than actual response body size at here. By grabbing packets to see, the HTTP response includes two reassembled tcp segments, so I only get an incomplete page. The correct result that should be returned is as follows.
<html>
 <head><title>404 Not Found</title></head>
 <body>
  <h1>404 Not Found</h1>
  <ul>
   <li>Code: NoSuchBucket</li>
   <li>RequestId: tx000000000000000000002-00612025dd-3529e9-default</li>
   <li>HostId: 3529e9-default-default</li>
  </ul>
 </body>
</html>


Related issues 3 (2 open1 closed)

Copied to rgw - Backport #62253: pacific: rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static websiteRejectedMark KoganActions
Copied to rgw - Backport #62254: quincy: rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static websiteNewMark KoganActions
Copied to rgw - Backport #62255: reef: rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static websiteNewMark KoganActions
Actions #2

Updated by Casey Bodley over 2 years ago

  • Status changed from New to In Progress
Actions #3

Updated by J. Eric Ivancich over 2 years ago

  • Assignee set to XiangRui Meng
Actions #4

Updated by Casey Bodley over 2 years ago

  • Status changed from In Progress to New
  • Backport changed from nautilus, octopus, pacific to octopus, pacific
Actions #5

Updated by Mark Kogan 10 months ago

testing the PR on current main

26fda85 2023-06-22 16:15 -0400 Ali Maredia                  M─┐ {origin/main} {origin/HEAD} Merge pull request #52156 from cbodley/wip-qa-rgw-s3tests-extra-attrs

with commit https://github.com/ceph/ceph/pull/42876/commits/cbeaef9fbe96c930fc10b793773e7ecd137fde81
two cases that reproduce the issue are addressed - 403 & 404.

repro env details:

- vstart cluster with following relevant configs:

vstart.sh ... -o rgw_enable_static_website=true -o rgw_dns_s3website_name=robsoni04.front.sepia.ceph.com

cat << _EOF_ >> ./index.html
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Welcome to my website!</h1>
<p>This is the index.html file, which is the default page that is shown when someone visits my website.</p>
<p>You can find other pages on my website by clicking on the links in the navigation bar.</p>
</body>
</html>
_EOF_

s3cmd mb s3://website
s3cmd put index.html s3://website
s3cmd setacl --acl-public s3://website/index.html
s3cmd ws-create --ws-index=index.html --ws-error=error.html s3://website

repro of 403 & 404 (before fix commit cherry-pick):


repro of 403 & 404 (AFTER fix commit cherry-pick):


Actions #6

Updated by Mark Kogan 9 months ago

  • Pull request ID set to 52341
Actions #7

Updated by Casey Bodley 9 months ago

  • Status changed from New to Pending Backport
  • Backport changed from octopus, pacific to pacific quincy reef
Actions #8

Updated by Backport Bot 9 months ago

  • Copied to Backport #62253: pacific: rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static website added
Actions #9

Updated by Backport Bot 9 months ago

  • Copied to Backport #62254: quincy: rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static website added
Actions #10

Updated by Backport Bot 9 months ago

  • Copied to Backport #62255: reef: rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static website added
Actions #11

Updated by Backport Bot 9 months ago

  • Tags changed from website to website backport_processed
Actions #12

Updated by Konstantin Shalygin 7 months ago

  • Assignee changed from XiangRui Meng to Mark Kogan
Actions

Also available in: Atom PDF