Skip to content

[ui5-middleware-approuter] Call to local CAP service returns 401 and weird response #1194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jowavp opened this issue Mar 31, 2025 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@jowavp
Copy link

jowavp commented Mar 31, 2025

Describe the bug
We use the ui5-middleware-approuter to test our multi-tenant CAP application.
To be able to test multiple consumers locally, we test our applications on first-consumer-dev.localhost:8080 and second-consumer-dev.localhost:8080.

When we start the app, the correct login screen appears. The app starts building up, but when a call is sent to the local srv-api destination. This returns a 401 with a weird body response.

Image

If we open the failed request url in the browser it shows the correct response. (http://first-consumer-dev.localhost:8080/odata/v4/service/$metadata)
If we then refresh the ap (http://first-consumer-dev.localhost:8080/index.html) it is serving correct and the data is received from the local CAP service.

Expected behavior
I expect the application to start directly with no 401 responses.

Screenshots
When opening index.html there are Error message in the console:

info server:custom-middleware:ui5-middleware-approuter GET /resources/sap/ui/core/cldr/nl.json -> http://localhost:1091/resources/sap/ui/core/cldr/nl.json [200]
#2.0#2025 04 01 01:05:26:148#+02:00#ERROR#/Handler#####87ec4877-cc83-4373-94ba-5992d45a1c6b####nfaSp2IYLxycXM4G6jYXKdgrAdjOdDUi######m8xogcji#PLAIN##GET request to /odata/v4/admin/$metadata?sap-language=NL completed with status 401 Authentication required#
info server:custom-middleware:ui5-middleware-approuter GET /odata/v4/admin/$metadata?sap-language=NL -> http://localhost:1091/odata/v4/admin/$metadata?sap-language=NL [401]
#2.0#2025 04 01 01:05:26:156#+02:00#ERROR#/Handler#####2e7764e7-0562-41aa-a430-647b322d596e####oMJBN7toE5IbqrglEyPMOY2bpUbvAcUi######m8xogcju#PLAIN##HEAD request to /odata/v4/admin/ completed with status 401 Authentication required#  
info server:custom-middleware:ui5-middleware-approuter HEAD /odata/v4/admin/ -> http://localhost:1091/odata/v4/admin/ [401]
info server:custom-middleware:ui5-middleware-approuter GET /resources/sap/ui/core/themes/sap_horizon/library.css -> http://localhost:1091/resources/sap/ui/core/themes/sap_horizon/library.css [200]

Image

when I open the call to $metadata in the browser it is a success:

Image

When I then refresh the browser window of the initial opened application it loads successfully.

Any Idea how I can fix this issue?

kr,
Joachim

@petermuessig petermuessig added the help wanted Extra attention is needed label Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants