Commit 7f1559f17040102b68953f9a9caff7a4c39994bf

Authored by Igor Kulikov
1 parent c7652824

Fix swagger redirect

... ... @@ -17,7 +17,9 @@ package org.thingsboard.server.config;
17 17
18 18 import org.springframework.stereotype.Controller;
19 19 import org.springframework.web.bind.annotation.RequestMapping;
  20 +import org.thingsboard.server.utils.MiscUtils;
20 21
  22 +import javax.servlet.http.HttpServletRequest;
21 23 import javax.servlet.http.HttpServletResponse;
22 24 import java.io.IOException;
23 25
... ... @@ -30,8 +32,9 @@ public class WebConfig {
30 32 }
31 33
32 34 @RequestMapping("/swagger-ui.html")
33   - public void redirectSwagger(HttpServletResponse response) throws IOException {
34   - response.sendRedirect("/swagger-ui/");
  35 + public void redirectSwagger(HttpServletRequest request, HttpServletResponse response) throws IOException {
  36 + String baseUrl = MiscUtils.constructBaseUrl(request);
  37 + response.sendRedirect(baseUrl + "/swagger-ui/");
35 38 }
36 39
37 40 }
... ...
... ... @@ -69,7 +69,7 @@ frontend http-in
69 69
70 70 acl transport_http_acl path_beg /api/v1/
71 71 acl letsencrypt_http_acl path_beg /.well-known/acme-challenge/
72   - acl tb_api_acl path_beg /api/ /swagger /webjars /v2/ /static/rulenode/ /oauth2/ /login/oauth2/ /static/widgets/
  72 + acl tb_api_acl path_beg /api/ /swagger /webjars /v2/ /v3/ /static/rulenode/ /oauth2/ /login/oauth2/ /static/widgets/
73 73
74 74 redirect scheme https if !letsencrypt_http_acl !transport_http_acl { env(FORCE_HTTPS_REDIRECT) -m str true }
75 75
... ... @@ -87,7 +87,7 @@ frontend https_in
87 87 http-request add-header "X-Forwarded-Proto" "https"
88 88
89 89 acl transport_http_acl path_beg /api/v1/
90   - acl tb_api_acl path_beg /api/ /swagger /webjars /v2/ /static/rulenode/ /oauth2/ /login/oauth2/ /static/widgets/
  90 + acl tb_api_acl path_beg /api/ /swagger /webjars /v2/ /v3/ /static/rulenode/ /oauth2/ /login/oauth2/ /static/widgets/
91 91
92 92 use_backend tb-http-backend if transport_http_acl
93 93 use_backend tb-api-backend if tb_api_acl
... ...