TeslaGov / ngx-http-auth-jwt-module

Secure your NGINX locations with JWT
MIT License
309 stars 118 forks source link

want to learn how to use the module #59

Closed ghost closed 3 years ago

tacerus commented 3 years ago

Honestly, the fact they ONLY provide this as a self-contained docker image is a shit move. Why would I want to spin up a separate Nginx container JUST for one single module?

JoshMcCullough commented 3 years ago

Hi there! This is an internal module we use, and decided to release it publicly in case others find it useful. It is not necessarily intended to meet every user's use case. That said, we use Docker to build the module, but it is not required to use the module.

Once you have built the module, you just drop the binary alongside the other NGINX modules on your server and you're good to go.

JoshMcCullough commented 3 years ago

Also, please see the README which describes how to include your JWT in either the Authorization header or in a cookie, e.g. Cookie: myjwt=abd1234....

tacerus commented 3 years ago

Hi @JoshMcCullough - Thanks a lot for the input! I attempted extracting the module from the docker container and dropping it along with the modules on the Nginx instance I wanted to utilize this module with, however it failed loading it due to not having been compiled with my version of Nginx. I might be missing how to properly utilize Docker to build Nginx modules. Would I need to update the Nginx version INSIDE the container, re-build the module INSIDE the container and then extract it? To me it would be a lot easier just having the files required to build it locally, however as said, I might really be missing something here.

JoshMcCullough commented 3 years ago

Yes, you have to compile it against the same NGINX version you're using. You can enter that value in the Dockerfile, here: https://github.com/TeslaGov/ngx-http-auth-jwt-module/blob/master/Dockerfile#L5

Then just run make rebuild-nginx again to build the updated module.