Skip to content

Commit 0ae3386

Browse files
committed
chore: use ldflags to set Server header
1 parent bf30297 commit 0ae3386

3 files changed

Lines changed: 2 additions & 6 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ENV CGO_LDFLAGS="-L/usr/local/lib -lssl -lcrypto -lreadline -largon2 -lcurl -lon
118118

119119
WORKDIR /go/src/app/caddy/frankenphp
120120
RUN GOBIN=/usr/local/bin \
121-
../../go.sh install -ldflags "-w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" -buildvcs=true && \
121+
../../go.sh install -ldflags "-w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'" -buildvcs=true && \
122122
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
123123
cp Caddyfile /etc/frankenphp/Caddyfile && \
124124
frankenphp version && \

alpine.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLA
123123

124124
WORKDIR /go/src/app/caddy/frankenphp
125125
RUN GOBIN=/usr/local/bin \
126-
../../go.sh install -ldflags "-w -s -extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" -buildvcs=true && \
126+
../../go.sh install -ldflags "-w -s -extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'" -buildvcs=true && \
127127
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
128128
([ -z "${NO_COMPRESS}" ] && upx --best /usr/local/bin/frankenphp || true) && \
129129
frankenphp version && \

caddy/module.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import (
2222
"github.com/dunglas/frankenphp/internal/fastabs"
2323
)
2424

25-
var serverHeader = []string{"FrankenPHP Caddy"}
26-
2725
// FrankenPHPModule represents the "php_server" and "php" directives in the Caddyfile
2826
// they are responsible for forwarding requests to FrankenPHP via "ServeHTTP"
2927
//
@@ -249,8 +247,6 @@ func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ c
249247
return caddyhttp.Error(http.StatusInternalServerError, err)
250248
}
251249

252-
// TODO: set caddyhttp.ServerHeader when https://github.com/caddyserver/caddy/pull/7338 will be released
253-
w.Header()["Server"] = serverHeader
254250
if err = frankenphp.ServeHTTP(w, fr); err != nil && !errors.As(err, &frankenphp.ErrRejected{}) {
255251
return caddyhttp.Error(http.StatusInternalServerError, err)
256252
}

0 commit comments

Comments
 (0)