Home > Enterprise >  HEAD requests are being changed to GET requests
HEAD requests are being changed to GET requests

Time:10-21

Good evening

I am trying to access the statObject for a file in my Minio service that is behing a nginx reverse proxy.

In Java, it clearly sends a HEAD request, but when I check my nginx access logs, it shows the following GET requests:

- - [18/Oct/2022:22:01:45  0000] "GET /clips/5KCgIJCO/thumbnail.png HTTP/2.0" 403 425 "-" "MinIO (Windows 10; amd64) minio-java/8.4.5"
- - [18/Oct/2022:22:01:46  0000] "GET /clips/5KCgIJCO/thumbnail.png HTTP/2.0" 403 425 "-" "MinIO (Windows 10; amd64) minio-java/8.4.5"
- - [18/Oct/2022:22:01:47  0000] "GET /clips/5KCgIJCO/thumbnail.png HTTP/2.0" 403 425 "-" "MinIO (Windows 10; amd64) minio-java/8.4.5"
- - [18/Oct/2022:22:01:47  0000] "GET /clips/5KCgIJCO/thumbnail.png HTTP/2.0" 403 425 "-" "MinIO (Windows 10; amd64) minio-java/8.4.5"
- - [18/Oct/2022:22:01:47  0000] "GET /clips/5KCgIJCO/thumbnail.png HTTP/2.0" 403 425 "-" "MinIO (Windows 10; amd64) minio-java/8.4.5"

I have tried using the more recent answer in this post, to no avail sadly: https://serverfault.com/questions/530763/nginx-proxy-cache-key-and-head-get-request (similar one here: https://github.com/minio/minio-js/issues/842#issuecomment-810282099)

I also tried setting the cache level to bypass in a cloudflare page rule, which didn't seem to change anything either.

Currently I have the proxy settings as follows:

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;

        proxy_connect_timeout 300;
        proxy_set_header Connection "";
        chunked_transfer_encoding off;

        proxy_cache_convert_head off;
        proxy_cache_methods GET HEAD;
        proxy_cache_key $scheme$request_method$proxy_host$request_uri;

        proxy_pass https://127.0.0.1:9000;
    }

Does anyone have an idea what I could be doing wrong?

EDIT: ofcourse the moment I post this I decided to try and enable Development Mode on CloudFlare which seemed to "fix" the issue, so it is indeed the CloudFlare cache changing HEAD -> GET.

Now I'll try to find out a way so I avoid this.

CodePudding user response:

This issue ended up being due to CloudFlare's caching, so I managed to solve it by creating a new Cache Rule that filters on the hostname for my Minio API and set Cache Status to "Bypass cache"

  • Related