How to access application api from oracle cloud instance?

43 Views Asked by At

I hava created a VM.Standard.E2.1.Micro instance from oracle cloud, and the instance is running a java applicaiton.

I want to access api from oralce cloud instance.

I have configured the Virtual cloud network's security list ingress to allow access to all IP addresses.

ping [public ip] is working. ssh to instance is working.

But I try to curl -X GET "http:[public ip]:[port]/example/api/..." always get connection refused.

Does anyone have any ideas?

2

There are 2 best solutions below

0
SA ID On

If you're trying to access the API from another machine, ensure there are no local firewalls blocking outgoing requests. Local firewalls can sometimes interfere with the connectivity to your Oracle Cloud instance. Verify and adjust your local firewall settings to allow the necessary outbound traffic.

0
Marcus23 On

I've solved this problem....

instance need to run the command

sudo systemctl enable firewalld

sudo systemctl start firewalld

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

sudo firewall-cmd --zone=public --add-port=443/tcp --permanent

sudo firewall-cmd --zone=public --add-port=[application port]/tcp --permanent

sudo firewall-cmd --reload

sudo firewall-cmd --list-all to check your firewall port