Martin Erlic
Martin Erlic

Reputation: 5667

Can I access my Springboot application without providing the port in the URL?

I ran mvn clean install on my project and compiled a fat JAR. It built without any errors. I moved the JAR to my server and ran java -jar app.jar from its file location. Now I when I hit the server's address I get the following:

403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.

I'm running Windows Server 2012R2. The folder C:\inetpub\wwwroot does serve webpage when I include an index.html file there. When I have nothing in there I get a 403 error. At some point I had the Springboot app running but I can't recall what had changed. Should I delete the inetpub folder? Why isn't my web app running from the provided JAR?

Edit: I just realized that if I use the IP address and the correct server port, i.e. http://00.00.00.0:8080/ then I can access the application. Is there a way to set this up so that the app launches with just the IP address? Is there anything I can put in my application.properties file, for example?

Upvotes: 0

Views: 2940

Answers (1)

JB Nizet
JB Nizet

Reputation: 691735

The standard HTTP port for HTTP is 80. So to omit the port in the URL, you need to set the server port of spring boot to 80.

And you realize that spring boot starts its own HTTP server, serving the application in the jar file, right? So the content if your wwwroot directory if completely irrelevant, and you shouldn't have another web server running on the machine to serve your spring boot app.

Upvotes: 1

Related Questions