I am trying to deploy an nginx
docker image. I need to create an endpoint to be used by my readiness probe, this should be a simple /healthz
endpoint that returns a 200 / OK.
I have tried the below, however this causes the browser to download a file containing the response and not render it as doc.
server {
listen 80;
server_name localhost;
location /healthz {
return 200 "OK\n";
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
# redirect server error pages
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
The default content-type is application/octet-stream
.
Try adding add_header Content-Type text/plain;
location / {
add_header Content-Type text/plain;
return 200 'OK';
}