From c0e54ee4deff6d9ffa8686bcb305d99c3eeb22dd Mon Sep 17 00:00:00 2001 From: Tyler Smith Date: Fri, 25 Oct 2019 17:45:02 -0400 Subject: [PATCH] Request forwarding and version matching in dcorch proxy Need to pass in the application to be the forwarder so when the version doesn't match the request can continue down the pipeline. It was 'mostly' working before since the version matching was registering all get requests as version requests and just forwarding them, this commit also restricts that version regex so that is no longer the case. Change-Id: I887027a043e2a686770d4ece0ae511e00814be61 Closes-Bug: 1849831 Signed-off-by: Tyler Smith --- dcorch/api/proxy/apps/acceptor.py | 2 +- dcorch/api/proxy/common/constants.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dcorch/api/proxy/apps/acceptor.py b/dcorch/api/proxy/apps/acceptor.py index df485b2b3..66fa8a391 100644 --- a/dcorch/api/proxy/apps/acceptor.py +++ b/dcorch/api/proxy/apps/acceptor.py @@ -131,4 +131,4 @@ class VersionAcceptor(Router): api_controller = VersionController(app, conf) mapper.connect(proxy_consts.VERSION_ROOT, controller=api_controller, conditions=dict(method=['GET'])) - super(VersionAcceptor, self).__init__(app, conf, mapper, None) + super(VersionAcceptor, self).__init__(app, conf, mapper, app) diff --git a/dcorch/api/proxy/common/constants.py b/dcorch/api/proxy/common/constants.py index d5074fad2..1249f3d0b 100755 --- a/dcorch/api/proxy/common/constants.py +++ b/dcorch/api/proxy/common/constants.py @@ -15,7 +15,9 @@ from dcorch.common import consts -VERSION_ROOT = '/{version:.*?}' +# Version could be any of the following: /, /v1, /v1/ +# but must deny regular paths such as /v1/isystems +VERSION_ROOT = '/{version:[^/]*?(\/$)?}' # Compute FLAVOR_RESOURCE_TAG = 'flavors'