I’m using Jelastic with two environments, one for my frontend and one for my backend.
Each environment has a Nginx load balancer with an IPv4, then an application server. For the backend (api), the application server is Spring-boot and for the frontend, it is Node.js
However, I have added IPv4 on each of my application servers to have direct access with my deployment scripts.
The concern now is that if I go directly through these IPs and no longer through the respective load balancers, I can still access my application but the connection is not secure.
I tried to close the incoming ports 80/443 on the application servers, but it doesn’t change anything, I still access with the IP.
Here is an image that quickly summarizes the problem (the ip used are not real):
Thank you for your help
EDIT :
2
Answers
You can restrict access to your spring-boot by configuring the firewall to allow only access from your load balancer.
You can follow that documentation.
This behaviour is caused by the
nat
tablePREROUTING
chain that pushes traffic from port 80 to 8080 on your Spring Boot node.This is configured by default by Jelastic for you (so you don’t need to do anything to get your application (on port 8080) accessible to the internet, but it means there’s a "hidden" part of the firewall rules that actually look like this on the server level:
So by the time that your traffic reaches the
filter
tableINPUT
chain (which is what you see within the Jelastic dashboard UI, and is processed afternat PREROUTING
), your traffic is actually on port 8080 – even if your browser request was on port 80 (or even 443, with SSL offload by the LB node).To get your desired behaviour, you need to set appropriate rule conditions for port 8080.
You need to vary the action based on
Source
:(use the priority to make sure the load balancer
ALLOW
is above the globalDENY
)!Example: