SpotiByeAds
SpotiByeAds copied to clipboard
Connecting UI with API
UI is installed and configured on server # 1 API configured on server # 2
How do I specify where the API is when starting the UI?
I haven't found anything like this anywhere in the documentation ...
I found such a mention in the GULP file, but I could not set this variable in any way - maybe there is some simple method (except for rewriting the GULP file itself)
Hope you could resolve the issue.
I modify config.api. Search for config and set api member.
On this topic - I have an issue when setting this member. It seems like the old UI sends a request directly to the server specified here and not using the proxy correctly.
This is causing CORS issues and the request is not getting through, despite setting the corsEnabled=true
in the API config. Is there a guide anywhere to get this working as intended? I assume many folks must have separate servers set up for their UI and API services.
Considering open source not detailed documentation, but hints are available in the documentation.
You also need - corsWhitelist=http://domain1.com:port,http://domain2.com:port
@VivekBuzruk - thanks for your answer I tried that and it's not working for me. After reviewing the logs, it looks like the UI is not able to send the xhr all the way to the api server as no request ever comes from the UI application. I think this is something to do with the config
I have validated that I can send a curl request from the machine running the UI directly to the api server and get the expected response so there are no network issues.
What paramater should be used for the config.api
member, it's unclear and does some strange things depending on the value:
- if left blank it defaults to
http://localhost:8080/api/pagesize
- if set to an ip address like
<ip-address>:<port>
hygieia concatenates the referrer and request url likehttp://<your domain here>:<port><ip-address:port>/api/pagesize
- and if you set the ip address like so
http://<ip-address>:<port>
hygieia sends the request tohttp://<ip-address>:<port>/api/pagesize
what is going on here? How is this meant to be set up to reach an external API server?
Probably also worth mentioning is when I run the new API (Angular 8) from the same machine, everything works as intended and the api server is connected just fine.
Hi!
I am not CORS expert - but as I used earlier, it should be -
say - Machine A (ABC) is running UI and Machine B (XYZ) is running API
(use IP and/or machine name for ABC and XYZ)
==========
1] config.api of UI ->http://XYZ:8080
2] application.properties of API ->
corsEnabled=true
corsWhitelist=http://ABC:<UI port>,http://localhost:<UI port>
api.corsEnabled=true
api.corsWhitelist=http://ABC:<UI port>,http://localhost:<UI port>
How you invoke UI today?
> http://localhost:<UI port> or http://<IPAddress>:<UI port> or http://<machine Name>:<UI port> ???
I suggest to check earlier Hygieia Issues discussing this challenge. Once successful, do post your solution.
I didn't have to deal with this issue for a long time, I got around this problem.
I deployed Hygieia in a k8s cluster where the API and UI are within the same pod and can exchange messages without changing configurations. Collectors are installed in other pods but in the same namespace.
The database is located on dedicated servers, so there were no problems connecting the collectors to the database ...
But if there was information on how to do this. For my colleagues and I have reached a dead end and realized that we do not need this.
Thanks for answers.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.