Search code examples
spring-bootcloudcaptain

How to enable port 80 or 443 for Spring Boot app deployed with BoxFuse


Spring Boot app is configured (default) to run Tomcat on port 8080. This application gets deployed on AWS via BoxFuse tool and exposed at port 8080 (as expected/configured).

I have tried setting server port to 80 in boot application properties but it causes permission denied issue and the solution seems to be modifying iptables or reverse proxy. ipTables modification is not possible due to boxFuse image/env not being editable.

Question: Is there a way in BoxFuse to setup the spring boot application on port 80 without actually setting up another instance for reverse proxy? It is an overhead to setup an instance just for port correction since can't change the iptables.

Also, Is it possible that this application is run with root privileges on the AWS instance so that I do not need to modify iptables or set up reverse proxy?


Solution

  • There is a -ports.Name option available when deploying the application with BoxFuse.

    Docs: https://cloudcaptain.sh/docs/gradle/run

    Example:

    boxfuse -ports.http=80 -env=test run myapprepo/myapp:0.1

    Verified on local dev environment. For Mac, it should be run as a privileged command via sudo

    sudo boxfuse -ports.http=80 run myapprepo/myapp:0.1

    To add, works for 443 too.