staticweb not working in conjunction with domain_remap

Bug #1190625 reported by Michal Skalski
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Medium
Unassigned

Bug Description

Hi,

I created container 'page' with this metatags:

X-Container-Meta-Web-Listings: true
X-Container-Read: .r:*,.rlistings
X-Container-Meta-Web-Index: index.html

and put index.html object there.

When visit like this : http://example.com/v1/AUTH_123456789/page
I got HTTP/1.1 200 OK and contet of index.html is displayed

When try use url resolved by domain_remap middleware: http://page.AUTH_123456789.example.com/
I got HTTP/1.1 301 Moved Permanently from staticweb with Location set to:
http://page.AUTH_123456789.example.com/v1/AUTH_123456789/page/

it's not proper url (duplication of container and account information) and if i follow get 404. The same happening when visiting pseudo directories.

http://page.AUTH_123456789.example.com/index.html works

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

Fix proposed to branch: master
Review: https://review.openstack.org/40255

Changed in swift:
assignee: nobody → Michal Skalski (michal+launchpad)
status: New → In Progress
Revision history for this message
clayg (clay-gerrard) wrote :

I can confirm this bug exists, the static-web redirect has no knowledge of the rewritten request and the remapping middleware(s) don't fix the response.

To reproduce I added the following to my proxy-server.conf:

    [pipeline:main]
    pipeline = catch_errors proxy-logging healthcheck cache cname_lookup domain_remap tempauth staticweb proxy-logging proxy-server

    [filter:cname_lookup]
    use = egg:swift#cname_lookup
    storage_domain = clayg.example.com

    [filter:domain_remap]
    use = egg:swift#domain_remap
    storage_domain = clayg.example.com

    [filter:staticweb]
    use = egg:swift#staticweb

I added a CNAME to DNS service* pointed to:

    page.auth_test.clayg.example.com

Then added an entry to my /etc/hosts:

    <ip.of.my.saio> page.auth_test.clayg.example.com

Then when I point my browser at "cname.mydomain.com" dns sends me to "page.auth_test.clayg.example.com" and hits the ip of my swift-all-in-one with the Host header still set to "cname.mydomain.com". The cname_lookup middleware translates the Host header in place to "page.auth_test.clayg.example.com" and domain_remap mangles the path w/o touching the Host resulting in "page.auth_test.clayg.example.com/v1/AUTH_test/page" (the trailing slash is *always* removed) which staticweb redirects to "page.auth_test.clayg.example.com/v1/AUTH_test/page/"

* I used GoDaddy, if your service is better you could try a wildcard CNAME or if you can spin up a caching name server (or if your router already has one) - you might be able to do something fancy.

Changed in swift:
assignee: Michal Skalski (mskalski) → nobody
Revision history for this message
Romain LE DISEZ (rledisez) wrote :
clayg (clay-gerrard)
Changed in swift:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/435771
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=107ba797708e07071028e021f2a261151562c9d7
Submitter: Jenkins
Branch: master

commit 107ba797708e07071028e021f2a261151562c9d7
Author: Romain LE DISEZ <email address hidden>
Date: Sat Feb 18 16:22:11 2017 +0100

    Rewrite redirection in cname_lookup & domain_remap

    cname_lookup and domain_remap are currently not catching redirections
    (eg: staticweb). This behavior makes the domain to change when a call
    through cname_lookup and domain_remap end up being redirected. Example:
    commit fixes it.
     - original request: http://mysite.com/subdir
     - redirected: http://cont.acct.storage.domain.com/v1/AUTH_acct/cont/subdir/
     - expected: http://mysite.com/subdir/

    This patch is fixing this.

    Closes-Bug: #1190625
    Co-Authored-By: Tim Burke <email address hidden>
    Change-Id: I67f642b8b070bc21e7760477d0a1e3b902ba7896

Changed in swift:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.15.0

This issue was fixed in the openstack/swift 2.15.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swift (master)

Change abandoned by Falk Reimann (<email address hidden>) on branch: master
Review: https://review.openstack.org/416924

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers