Skip to content

Issue 1255 server port sb fix#1256

Open
stokpop wants to merge 3 commits intocloudfoundry:mainfrom
stokpop:issue-1255-server-port-sb-fix
Open

Issue 1255 server port sb fix#1256
stokpop wants to merge 3 commits intocloudfoundry:mainfrom
stokpop:issue-1255-server-port-sb-fix

Conversation

@stokpop
Copy link
Copy Markdown
Contributor

@stokpop stokpop commented Apr 28, 2026

fixes #1255

stokpop added 3 commits April 28, 2026 10:56
Apps with server.port set in application.yml would bind to the wrong
port at startup, causing CF health checks to fail. Apps with a
privileged port (< 1024, e.g. 443) would crash immediately with
java.net.BindException: Permission denied.

Mirrors the Ruby buildpack behaviour in spring_boot.rb release().

Fixes cloudfoundry#1255
…runtime

WriteEnvFile writes the literal string "$PORT" to deps/0/env/SERVER_PORT.
CF's launcher reads env files as plain text (no shell expansion), so Spring Boot
received the literal string "$PORT" as the port, which is invalid and ignored,
leaving server.port from application.yml in effect.

Replace with WriteProfileD which writes a bash profile.d script that is
*sourced* at container start — so $PORT is expanded to the actual CF-assigned
port number before Spring Boot initialises its embedded server.

This fixes:
  - apps binding to a hardcoded port instead of the CF-assigned $PORT
  - java.net.BindException: Permission denied for privileged ports (e.g. 443)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SERVER_PORT=$PORT not injected for Spring Boot JAR apps

1 participant