Our background service support is configurable. App needs to configure the accessible background service address when logging in, and also need to configure the access address of the front-end service. Because we deploy front-end and back-end separately, the ip port numbers of front-end and back-end services are different. At this time, app login needs to configure two interface addresses, which is too troublesome to operate.
The solution is that the interface address configured by app is the front-end ip+ port number, and the back-end address is no longer configured. Apache, the front-end service, needs to provide the function of reverse proxy, which forwards the request for accessing the background interface sent by app to the background service and returns the background response to app.
Front-end service address: http:/172.21.38.1:6060
Background service address: http:/172.5438+0.38.2: 8080.
Originally, when the app loaded the homepage, it directly visited http:/172.21.38.1:6060/main/home; When accessing the background interface, directly access http:/172.21.38.2: 8080/API/getrolelist.
After apache provides the reverse proxy, the way of app accessing the front-end page remains unchanged, and the back-end access becomes http:/172.438+0.38.1:6060/proxyya/API/getrolelist. Because the front-end service apache is configured with proxyA's proxy mode, the request will be distributed directly to the background address.