1. Esau Redwan
  2. PowerServer
  3. Friday, 2 February 2024 22:19 PM UTC

Hi All,

I followed the instructions here in the documentation: https://docs.appeon.com/ps2022r3/Modifying_WebAPIURL_for_Nginx_Windows.html

I changed my  apprun.json to point to my reverse proxy server and then rebuild solution and run the project in SnapDevelop. When checking the logs, it is not using the "web_api" change I made in apprun.json. 

I did a project directory search for any other instances of "localhost:5099" to find if I need to change the URL elsewhere and the only other location its in is launchSettings.json. 

Does anyone have any ideas on how to point to my reverse proxy within my local development environment?

Tracy Huang @Appeon Accepted Answer Pending Moderation
  1. Monday, 5 February 2024 01:41 AM UTC
  2. PowerServer
  3. # 1

Hi Esau,

launchSettings.json configures the URL of the Web APIs when run in the development environment.

You can tell if the hosting environment is production or environment, from the line "Hosting environment: xxx", and the Web API URL from the line "Now listening on: xxx" in the server console.

In your case, if the Web APIs run in the local development environment, and the URL in launchSettings.json is localhost:5099, that means the real URL is localhost:5099. Make sure this URL is configured in the reverse server configuration: https://docs.appeon.com/ps2022r3/Configuring_Nginx_reverse_proxy_Windows.html.

Please double check and provide more details including nginx.conf, apprun.json, and the logs in the server console.

Regards

Tracy

Comment
  1. Tracy Huang @Appeon
  2. Tuesday, 20 February 2024 03:10 AM UTC
Hi Esau,



When PowerServer Web APIs is directly run from the PowerBuilder IDE or SnapDevelop, it runs on the Kestrel server, and Kestrel will run at the URL specified in the launchSettings.json file. This URL also becomes the URL of Web APIs in the local development environment.



launchSettings.json is a config file for Kestrel (not for PowerServer or the cloud app). For more information about launchSettings.json, please refer to the following links:

https://docs.appeon.com/ps2022r3/Builtin_Kestrel.html

https://docs.appeon.com/ps2022r3/Kestrel_dev.html



From the launchSettings.json you provided, if Web APIs on Kestrel will run at https://localhost:5099/, you will need to configure nginx.conf to redirect requests to https://localhost:5099/ ("localhost" should be replaced with ip or domain, for example, https://172.16.100.35:5099, you can verify the URL first using https://172.16.100.35:5099/health-ui/.)



server {

listen 8080;

location / {

proxy_set_header Host $http_host;

proxy_pass https://172.16.100.35:5099;

}

}



After verifying this works in the local development environment, you can start Web APIs/Kestrel in the production environment by following: https://docs.appeon.com/ps2022r3/Kestrel_prod.html.



Regards

Tracy
  1. Helpful
  1. Tracy Huang @Appeon
  2. Tuesday, 20 February 2024 03:26 AM UTC
What you are trying to test below should be accomplished through load-balancing. Please refer to https://docs.appeon.com/ps2022r3/Configuring_Nginx_as_a_load_balancer.html:

my PC running local kestrel powerserver on localhost:5099 -> connects to reverse proxy server ip: 1.2.3.4. -> reverse proxy routes to another server with web_api running with ip: 5.6.2.3

  1. Helpful
  1. Tracy Huang @Appeon
  2. Tuesday, 20 February 2024 03:37 AM UTC
And only load-balancing is supported. Fail-over is not.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.