Containerized Nginx Plus is Unable to Open or Rename Okta JWK File

Solution 1:

Under the "Troubleshooting" header from the nginx-openid-connect repository you linked, the final bullet underneath "Authentication is successful but browser shows too many redirects" instructs you to ensure that the nginx user has access to the JWK file.

This is not referring to an Okta user or account; this is referring to the nginx user within your Docker image. If you:

docker run \
--entrypoint="" \
--interactive \
--tty \
$NGINX_PLUS_IMAGE_ID \
cat /etc/nginx/nginx.conf

#=>

user  nginx;
. . .

you can see that the base Nginx config. file uses the nginx user instead of root.

We should give nginx access to all files within the /etc/nginx directory with the:

RUN ["chown", "-R", "nginx:nginx", "/etc/nginx"]

Dockerfile instruction.