openresty / openresty/set-misc-nginx-module

Using NGINX as S3 Proxy for minio?

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
401
Forks
100
Avg merge
1h 28m
Merged PRs (30d)
2

Description

is maybe someone here that has done a NGINX config to proxy S3 requests from minio with proper authentification using NGINX with lua and misc module? e.g. Something like this:

location /media  {
            set $bucket           'media';
            set $aws_access       'AKIAIOSFODNN7EXAMPLE';
            set $aws_secret       'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY';
            set $url_full         "$1";
            set $aws_signature    '';
            set_by_lua $now       "return ngx.http_time(ngx.time())";
            set $string_to_sign   "$request_method\n\n\n\nx-amz-date:${now}\n/$url_full/$bucket";
            set_hmac_sha1          $aws_signature $aws_secret $string_to_sign;
            set_encode_base64      $aws_signature $aws_signature;
            resolver_timeout       10s;
            proxy_http_version     1.1;
            proxy_set_header       x-amz-date $now;
            proxy_set_header       Authorization "AWS $aws_access:$aws_signature";
            proxy_buffering        off;
            proxy_intercept_errors on;
            rewrite .* /$url_full break;
            proxy_pass             http://backend-data;
            proxy_set_header       Host $http_host;
            add_header X-Content-Type-Options nosniff;

Currently there is no clean implementation for django 2.x to communicate with minio or at least i was not able to make those working and i tried a lot of the available plug-ins according to that proplem. Currently my methode shown above returns the following error: "The request signature we calculated does not match the signature you provided. Check your key and signing method." Any idea on that? to me it seems that i put the string together correctly

Thanksful for any help.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the NGINX location /media configuration shown in the issue and inspect how its AWS signature is assembled for Minio. Compare the generated authorization and date values with the S3 request requirements; done means requests proxy successfully without the signature-mismatch error.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, lua, nginx
Domain
api, backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.