on 2025 Jan 06 8:14 AM
Hello
I am trying to access the service of a CAP application from another CAP application both the applications are deployed.
Current Environment is local, I have bounded the local approuter to the service which I need to use, when using directly via browser the API works. But when the UI application tries to call any API, it gives CORS issue.
Tried using extensions to disable/enable CORS but still no luck.
Directory structure for UI
xs-app.json for router
we have CORS middleware in service layer as well
When the manifest is being loaded gives cors
Request clarification before answering.
This is the issue:
"The url which gives the error is localhost:5000/{serviceRoute} the one that calls is localhost:4004"
Change your UI application to only make requests the same origin as it is served from. Let approuter which serves it route the requests to the correct url/destination.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when I try to make request to port 4004 where the main application is running the service request give 404. in approuter I am calling the correct destination which is a deployed service on BTP
You should not add hostname in the uri property of data source. Typical CAP (development) server setup only allows for requests to one (the same) CAP application. If you want to connect to two CAP application you need to access the application using a reverse proxy that will route the requests correctly; either use approuter or use backend proxy in Fiori/UI5 tools.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.