Search code examples
herokuexecutable-jarhostname

Why does this heroku-hosted java app return 404?


I have a .jar file that listens for requests and streams music (lavalink). When I run it locally on my own computer, I can make requests to it and everything works fine. However, when I move it to be hosted on heroku, trying to send a request to the app just results in nothing happening.

I am using "https://my-app-name.herokuapp.com" as the hostname to connect to, and the port I am using is the one that shows up in the logs:

Starting process with command java -Dserver.port=27955 -jar Lavalink.jar

                                                   ^this one

Am I doing something wrong? Can Heroku maybe not find the java app? Do I need to provide a different hostname or port?


Solution

  • Turns out that Heroku always listens on port 80 for external requests and then routes the traffic to the port that shows up in the logs. Rewriting the config file (that the java app uses) during build to use the port that shows up in the logs seems to work.