staticweb not working in conjunction with domain_remap

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

Bug Description


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 :
I got HTTP/1.1 200 OK and contet of index.html is displayed

When try use url resolved by domain_remap middleware:
I got HTTP/1.1 301 Moved Permanently from staticweb with Location set to:

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

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

Fix proposed to branch: master

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 = catch_errors proxy-logging healthcheck cache cname_lookup domain_remap tempauth staticweb proxy-logging proxy-server

    use = egg:swift#cname_lookup
    storage_domain =

    use = egg:swift#domain_remap
    storage_domain =

    use = egg:swift#staticweb

I added a CNAME to DNS service* pointed to:

Then added an entry to my /etc/hosts:


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

* 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)

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:
     - redirected:
     - expected:

    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

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

Other bug subscribers