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
JavaBot
JavaBotβ€’3w ago
βŒ› This post has been reserved for your question.
Hey @Danish Pirate! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1stβ€’3w ago
Does the Spring application receive the request? Is the request routed to the application? How?
danishpirate
danishpirateOPβ€’3w ago
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)
dan1st
dan1stβ€’3w ago
logging?
danishpirate
danishpirateOPβ€’3w ago
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?
dan1st
dan1stβ€’3w ago
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...
dan1st
dan1stβ€’3w ago
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 🐱
danishpirate
danishpirateOPβ€’3w ago
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
dan1st
dan1stβ€’3w ago
I assume curling from the VM to the VM works?
danishpirate
danishpirateOPβ€’3w ago
Yes Outside, no
dan1st
dan1stβ€’3w ago
Can you ping the VM?
danishpirate
danishpirateOPβ€’3w ago
yes
dan1st
dan1stβ€’3w ago
How did you open the ports? iptables?
danishpirate
danishpirateOPβ€’3w ago
ufw
dan1st
dan1stβ€’3w ago
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)
danishpirate
danishpirateOPβ€’3w ago
@dan1stLogs show nothing. I ran iptables -L and this is what I got: https://pastebin.com/zAf7chT7
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.
danishpirate
danishpirateOPβ€’3w ago
My guess is that the endpoint is never reached.
dan1st
dan1stβ€’3w ago
Chain INPUT (policy DROP)
target prot opt source destination
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere
Chain INPUT (policy DROP)
target prot opt source destination
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere
policy DROP for chain INPUT means drop incoming packets by default unless specified otherwise
danishpirate
danishpirateOPβ€’3w ago
Okay. What should I change then?
dan1st
dan1stβ€’3w ago
idk the exact ufw rules Can you show the ufw config? Can you run iptables-save? This should show the exact iptables rules
danishpirate
danishpirateOPβ€’3w ago
The rules look like this. I dont know if this is what you want
Status:
To Action From
-- ------ ----
22/tcp ALLOW
80/tcp ALLOW
22/tcp (v6) ALLOW Anywhere (
80/tcp (v6) ALLOW Anywhere (v6)
Status:
To Action From
-- ------ ----
22/tcp ALLOW
80/tcp ALLOW
22/tcp (v6) ALLOW Anywhere (
80/tcp (v6) ALLOW Anywhere (v6)
dan1st
dan1stβ€’3w ago
specifically looking for -A INPUT this allows 80 but not 8080
danishpirate
danishpirateOPβ€’3w ago
It added them automatically when I did ufw allow http. Manually adding 8080 changes nothing. Page still doesnt load.
dan1st
dan1stβ€’3w ago
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 again
danishpirate
danishpirateOPβ€’3w ago
Still doesn't load.
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
8080/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
8080/tcp (v6) ALLOW Anywhere (v6)
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
8080/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
8080/tcp (v6) ALLOW Anywhere (v6)
danishpirate
danishpirateOPβ€’3w ago
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.
dan1st
dan1stβ€’3w ago
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 there
dan1st
dan1stβ€’3w ago
also 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?
dan1st
dan1stβ€’3w ago
It's also possible there's something in between that blocks port 8080 (not in the VM)
danishpirate
danishpirateOPβ€’3w ago
@dan1stNo UFW logs. Also no logs when using netcat.
dan1st
dan1stβ€’3w ago
Did you enable logging with ufw?
danishpirate
danishpirateOPβ€’3w ago
Yes even set it to high There are simply no ufw log files in the specified directory
dan1st
dan1stβ€’3w ago
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
danishpirate
danishpirateOPβ€’3w ago
Still nothing
dan1st
dan1stβ€’3w ago
How exactly are you doing it?
danishpirate
danishpirateOPβ€’3w ago
I enter sudo nc -lvnp 80 in the vm terminal and then enter [ip]:80 into my browser url or postman.
dan1st
dan1stβ€’3w ago
ok
danishpirate
danishpirateOPβ€’3w ago
Is it possible the port hasn't been forwarded?
dan1st
dan1stβ€’3w ago
yes idk the used setup
JavaBot
JavaBotβ€’3w ago
πŸ’€ 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.

Did you find this page helpful?