WSO2 API Manager 4.2.0 – 404 redirects to /carbon page. Can this be reconfigured?

huangapple go评论53阅读模式
英文:

WSO2 API Manager 4.2.0 - 404 redirects to /carbon page. Can this be reconfigured?

问题

配置信息:

  • API Manager 4.2.0 在 Linux 上运行。
  • NGINX 配置为反向代理。
  • API-M 门户 (https://proxy-hostname/publisher/、/devportal/、/admin/、/console/) 正常工作。
  • 访问根域名 (https://proxy-hostname/) 会重定向到发布者门户 (https://proxy-hostname/publisher/),这是预期的行为。

访问不存在的页面(例如 https://proxy-hostname/test/)会重定向到 Carbon 管理控制台 (https://proxy-hostname/carbon/admin/login.jsp)。

我们不希望用户在输入错误的 URL 时被重定向到管理控制台。

问题: 是否可以通过更新 WSO2 API Manager 配置来重新配置这个 404 重定向到不同的 URL?

研究:
我找到了两个先前的(已回答)问题:

你能改变 WSO2 的根重定向吗?

WSO2 应用服务器在 404 错误时会重定向到 "/carbon" 预期的

这些答案建议编辑 repository/conf/carbon.xml 文件设置。

然而,与以前的产品版本相比,API Manager 4.2.0 的配置过程已经发生了变化,因此根据这些旧答案(针对以前的版本)编辑 XML 文件将在重新启动时被覆盖。

英文:

Configuration:

  • API Manager 4.2.0 on linux.
  • NGINX configured for reverse proxy.
  • The API-M portals (https://proxy-hostname/publisher/, /devportal/, /admin/, /console/) are working.
  • Navigating to the root domain (https://proxy-hostname/) redirects to publisher portal (https://proxy-hostname/publisher/) - as expected.

Navigating to a page that does not exist (e.g. https://proxy-hostname/test/) redirects to the carbon admin console (https://proxy-hostname/carbon/admin/login.jsp)

We do not wish end users to be directed towards the admin console if they enter an incorrect URL.

Question: Is is possible to reconfigure this 404 redirect to a different URL by updating WSO2 API Manager configuration?

Research:
I have found two previous (answered) questions:

Can you change the WSO2 root redirect?

WSO2 Application Server will redirect to "/carbon" upon 404 error is expected

These answers suggest editing the repository/conf/carbon.xml file setting.

However, API Manager 4.2.0 configuration process has changed compared to previous product releases, so editing xml files as per these old answers (for previous release versions) will get overritten upon restart.

答案1

得分: 1

AFAIK,在应用层内没有方法来实现这一点。最简单的解决方案是在NGINX上执行此操作。您可以列出您想要允许的所有上下文,并添加一个默认块来返回其他所有上下文的错误。

更新

要白名单的Naginx上下文:

  • /devportal
  • /admin
  • /publisher
  • /api
  • /oauth2
  • /oidc
  • /authenticationendpoint
  • /logincontext
  • /commonauth
英文:

AFAIK there is no way to do this within the Application layer. The easiest solution is to do this at NGINX. You can whitelist all the contexts you want to allow and add a default block to return an error for all the others.

Update

Naginx contexts to whitelist.

  • /devportal
  • /admin
  • /publisher
  • /api
  • /oauth2
  • /oidc
  • /authenticationendpoint
  • /logincontext
  • /commonauth

huangapple
  • 本文由 发表于 2023年5月24日 22:27:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76324619.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定