Skip to content

Commit 9bb3fc7

Browse files
committed
feat: update wallet provider redirect configuration for Swagger UI to handle path prefixes
1 parent eb32a41 commit 9bb3fc7

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎deploy/compose.yaml‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,25 @@ configs:
386386
sub_filter 'src="/static/' 'src="/frontend/static/';
387387
sub_filter_once off;
388388
389-
# The wallet provider redirects / to its Swagger UI as an absolute /swagger,
390-
# and nothing tells it it lives under /wallet-provider/, so the browser drops
391-
# the prefix and gets the status list's 404. nginx's default proxy_redirect
392-
# only rewrites absolute URLs naming the upstream; this adds the relative
393-
# form. Kept here rather than in the app, as with the two rewrites above.
389+
# Nothing tells the wallet provider it lives under /wallet-provider/, so its
390+
# absolute paths drop the prefix and reach the status list's 404:
391+
# - it redirects / to its Swagger UI as /swagger. nginx's default
392+
# proxy_redirect only rewrites absolute URLs naming the upstream; the
393+
# second one adds the relative form.
394+
# - the Swagger UI page loads /swagger/openapi.json, and its OAuth2 redirect
395+
# is under /swagger/ too.
396+
# - the spec has no servers, so Swagger UI's "Try it out" calls the API at
397+
# the host root. A servers entry with the prefix goes in before "paths".
398+
# Kept here rather than in the app, as with the two rewrites above.
394399
# sha1("/wallet-provider/") = 6ce92592c2ac02a738d464460ca179a499a84834
395400
wallet-provider-redirect:
396401
content: |
397402
proxy_redirect default;
398403
proxy_redirect / /wallet-provider/;
404+
sub_filter_types application/json;
405+
sub_filter "'/swagger/" "'/wallet-provider/swagger/";
406+
sub_filter '"paths": {' '"servers": [{"url": "/wallet-provider"}], "paths": {';
407+
sub_filter_once off;
399408
400409
# RFC 8414 puts discovery metadata at the host root regardless of a service's
401410
# path, and on this hostname the root belongs to the status list. Without these

0 commit comments

Comments
 (0)