Springboot not serving webpage
@dan1st My Springboot app on a VM is not serving a webpage when I enter its ip and port into a browser, the browser loads and then times out. I have allowed connections on port 8080 in the firewall, but still does not work. I have confirmed it works locally. Do you have any ideas as to what the issue could be?
40 Replies
β
This post has been reserved for your question.
Hey @Danish Pirate! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Does the Spring application receive the request?
Is the request routed to the application? How?
How do I check whether the request is received? I know the GetMapping method is never called at least.
The app starts up and I can confirm itβs listening on the http port (8080)
logging?
The app log just tells me that the application has started and what point its listening on.
Is it possible to get logs for incoming connections?
Stack Overflow
Spring Boot - How to log all requests and responses with exceptions...
I'm working on REST API with spring boot. I need to log all requests with input params (with methods, eg. GET, POST, etc.), request path, query string, corresponding class method of this request, a...
or add your own log to the endpoint
What kind of VM are you using?
And how did you configure networking there?
also try telnet/curl
or netcat π±
The VM was provided by the uni and it uses Debian as OS. Regarding networking, all I did was open the appropriate ports. I have tried curl with the same result ( just times out). I will try changing the log filter
I assume
curl
ing from the VM to the VM works?Yes
Outside, no
Can you ping the VM?
yes
How did you open the ports? iptables?
ufw
ugh
I can check later
you can use
iptables -L
to list iptables rules
I think ufw might use iptables under the hood
yeah it seems like ufw is just something on top of iptables
I never used it for anything
Is it even enabled?
maybe show the iptables -L
output
though on most systems, ports should be open by default
(also note that iptables stuff will reset when restarting the VM)Pastebin
Chain INPUT (policy DROP)target prot opt source d...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
My guess is that the endpoint is never reached.
policy DROP for chain INPUT means drop incoming packets by default unless specified otherwise
Okay. What should I change then?
idk the exact ufw rules
Can you show the ufw config?
Can you run
iptables-save
? This should show the exact iptables rulesThe rules look like this. I dont know if this is what you want
specifically looking for
-A INPUT
this allows 80 but not 8080It added them automatically when I did
ufw allow http
. Manually adding 8080 changes nothing.
Page still doesnt load.http is port 80
not 8080
you'd need to use 80/tcp
so
sudo ufw allow 8080/tcp
I think
and then check the ufw config againStill doesn't load.
Pastebin
Generated by iptables-save v1.8.9 (nf_tables) on Fri Feb 14 15:39...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
hm, I don't see anything about port 8080 there
Can you run
sudo ufw disable
and then sudo ufw enable
to restart ufw?
Also instead of the Spring application, configure netcat to listen on that port
in some bash session
then you should see incoming connections therealso you can use logging: https://serverfault.com/a/516840/534944
Server Fault
Where are the logs for ufw located on Ubuntu Server?
I have an Ubuntu server where I am blocking some IPs with ufw. I enabled logging, but I don't know where to find the logs. Where might the logs be or why might ufw not be logging?
It's also possible there's something in between that blocks port 8080 (not in the VM)
@dan1stNo UFW logs. Also no logs when using netcat.
Did you enable logging with ufw?
Yes
even set it to high
There are simply no ufw log files in the specified directory
Then I guess there's something between you and the VM that blocks it
Does port 80 work?
(you can use netcat there)
note that listening on port 80 requires root
Still nothing
How exactly are you doing it?
I enter
sudo nc -lvnp 80
in the vm terminal and then enter [ip]:80
into my browser url or postman.ok
Is it possible the port hasn't been forwarded?
yes
idk the used setup
π€
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.