The *_swift_info functions use in module global dicts to provide a
registry mechanism for registering and getting swift info.
This is an abnormal pattern and doesn't quite fit into utils. Further
we looking at following this pattern for sensitive info to trim in the
future.
So this patch does some house cleaning and moves this registry to a new
module swift.common.registry. And updates all the references to it.
For backwards compat we still import the *_swift_info methods into utils
for any 3rd party tools or middleware.
Change-Id: I71fd7f50d1aafc001d6905438f42de4e58af8421
The root_path option for domain_remap seems to serve two purposes:
- provide the first component (version) for the backend request
- be an optional leading component for the client request, which
should be stripped off
As a result, we have mappings like:
c.a.example.com/v1/o -> /v1/AUTH_a/c/o
instead of
c.a.example.com/v1/o -> /v1/AUTH_a/c/v1/o
which is rather bizarre. Why on earth did we *ever* start doing this?
Now, this second behavior is managed by a config option
(mangle_client_paths) with the default being to disable it.
Upgrade Consideration
=====================
If for some reason you *do* want to drop some parts of the
client-supplied path, add
mangle_client_paths = True
to the [filter:domain_remap] section of your proxy-server.conf. Do this
before upgrading to avoid any loss of availability.
UpgradeImpact
Change-Id: I87944bfbf8b767e1fc36dbc7910305fa1f11eeed
The root_path option for domain_remap seems to serve two purposes:
- provide the first component (version) for the backend request
- be an optional leading component for the client request, which
should be stripped off
As a result, we have mappings like:
c.a.example.com/ -> /v1/AUTH_a/c/
c.a.example.com/o -> /v1/AUTH_a/c/o
c.a.example.com/v1/o -> /v1/AUTH_a/c/o
Currently, we don't really care about whether there was a full- or
partial-match in that first component, leading to mappings like
c.a.example.com/v1o -> /v1/AUTH_a/c/o
If we're going to continue supporting that second function, we should
only consider full-matches, so we'll have
c.a.example.com/v1o -> /v1/AUTH_a/c/v1o
Change-Id: Ibdc97bb8daf117ad46177617f170d03e481b0007
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 <tim.burke@gmail.com>
Change-Id: I67f642b8b070bc21e7760477d0a1e3b902ba7896
domain_remap strip all starting/ending slashes. This behavior does not
allow to access objects starting or ending with slash. It is also
impacting staticweb middleware as staticweb tries to redirect
pseudo-directory to an URL with an ending slash, but as domain_remap
strip it, it goes to an infinite loop.
With this commit, the path of the request is passed as-is when
reconstructing the new request path. Example
http://www.example.com//obj/ was previously rewritten to
http://storage.example.com/v1/AUTH_abc/container/obj. It is now
rewritten to http://storage.example.com/v1/AUTH_abc/container//obj/
Closes-Bug: #1682293
Co-Authored-By: Christian Schwede <cschwede@redhat.com>
Change-Id: I1ef6b8752183d27103a3b0e720edcb4ce06fb837
Middleware domain_remap can work with cname_lookup middleware. This last
middleware accept that storage_domain is a list of domains. To be
consistent, domain_remap should have the same behavior.
Closes-Bug: #1664647
Change-Id: Iacc6619968cc7c677bf63e0b8d101a20c86ce599
assertEquals is deprecated in py3, replacing it.
Change-Id: Ida206abbb13c320095bb9e3b25a2b66cc31bfba8
Co-Authored-By: Ondřej Nový <ondrej.novy@firma.seznam.cz>
Also added the value of default_reseller_prefix to /info. I did not
add the reseller_prefixes value to /info because deployers may not
want to expose all of the resellers that are available.
Change-Id: I9ca2f002dc395913bb646390d6908dfb8f554df1
Previously, the reseller prefix needed to be provided in the host name
even when the domain was unique to that reseller. With the
default_reseller_prefix, any domain which matches in this middleware,
will will be passed on with a reseller prefix, whether or not it was
provided.
Change-Id: I5aa5ce78ad1ee2e3660cce4c3e07306f8999f02a
Implements: blueprint domainremap-reseller-domains
If domain_remap and cname_lookup received request which has no host header,
then returns 500 error. This fixes that problem.
Change-Id: Ibb457e9b4cb21181d8243858c04ce255365690da
Fixes: bug #1100632
This change replaces WebOb with a mostly compatible local library,
swift.common.swob. Subtle changes to WebOb's API over the years have been a
huge headache. Swift doesn't even run on the current version.
There are a few incompatibilities to simplify the implementation/interface:
* It only implements the header properties we use. More can be easily added.
* Casts header values to str on assignment.
* Response classes ("HTTPNotFound") are no longer subclasses, but partials
on Response, so things like isinstance no longer work on them.
* Unlike newer webob versions, will never return unicode objects.
Change-Id: I76617a0903ee2286b25a821b3c935c86ff95233f
The code has moved to https://github.com/notmyname/swift-domainremap.
For current users of domain remap, this will require installing the new
package and changing the "use" line of the domain remap conf section's
to:
[filter:domain_remap]
use = egg:swift_domainremap#swift_domainremap
And then 'swift-init proxy reload'.
Change-Id: I710caf9b991f9d37df36b826ae4338086d0ec36d