Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

405 Not Allowed for PUT method #359

Open
eanikindfi opened this issue Jan 20, 2025 · 1 comment
Open

405 Not Allowed for PUT method #359

eanikindfi opened this issue Jan 20, 2025 · 1 comment

Comments

@eanikindfi
Copy link

Describe the bug

I have no idea if it is a bug of some sort or we just can't find a right solution.
We try to use nginx-s3-gateway in our k8s-enviroment for proxing requests to AWS S3 bucket. So long story short our route is:
client > DNS > NLB > k8s > ingress-controller > nginx-s3-gateway pod > AWS S3 bucket.

We are keep receiving a 405 response for PUT method, when trying to work with AWS S3 bucket.
Just to be clear, GET method is working fine.
For example, if we have a file test-s3.txt in our bucket and we call:
curl https://nginx-test.my-domain.net/api/s3/test-s3.txt
Then we receive 200 response and contents of the file.

To reproduce

Steps to reproduce the behavior:

  1. curl https://nginx-test.my-domain.net/api/s3/ --upload-file testing-file.txt
  2. An error after the curl command:
    <html><head><title>405 Not Allowed</title></head><body><center><h1>405 Not Allowed</h1></center><hr><center>nginx</center></body></html>
  3. An error in nginx-s3-gateway pod's log:
    10.111.22.333 - - [20/Jan/2025:07:42:48 +0000] "PUT /testing-file.txt HTTP/1.1" 405 150 "-" "curl/7.88.1" "10.444.5.66"

Expected behavior

Allowed methods for requests should be controllable via some set of configuration. The PUT method is acceptable and response is 200.

Also we've tried to use s3listing_location.conf.template to inject additional configuration like so, but got a negative result as well:

# Deployment values for nginx-s3-gateway:
  volumeMounts:
      - name: s3-location
        mountPath: /etc/nginx/templates/gateway/s3listing_location.conf.template
        subPath: s3listing_location.conf.template
  volumes:
    - name: s3-location
      configMap:
        name: s3-location-configmap
        items:
          - key: config
            path: s3listing_location.conf.template
# ConfigMap values:
  configuration:
    enabled: true
    name: s3-location
    s3Location: |
      dav_methods PUT;

Checks inside the container:

cat /etc/nginx/templates/gateway/s3listing_location.conf.template
dav_methods PUT;
cat /etc/nginx/conf.d/gateway/s3listing_location.conf
dav_methods PUT;

Your environment

  • Version of this project or specific commit when building your own S3 container = nginxinc/nginx-s3-gateway:latest-njs-oss-20241223;
  • S3 backend implementation = AWS;
  • Authentication method = AWS Credentials (IAM keys);
  • AWS EKS version = v1.31.4-eks-2d5f260.

Additional context

Our environment variables for nginx-s3-gateway deployment:

  extraEnv:
    - name: S3_BUCKET_NAME
      value: "my-bucket"
    - name: S3_SERVER
      value: "s3.ap-southeast-1.amazonaws.com"
    - name: S3_SERVER_PROTO
      value: "https"
    - name: S3_SERVER_PORT
      value: "443"
    - name: DEBUG
      value: "true"
    - name: S3_STYLE
      value: "virtual"
    - name: S3_REGION
      value: "ap-southeast-1"
    - name: AWS_REGION
      value: "ap-southeast-1"
    - name: AWS_SIGS_VERSION
      value: "4"
    - name: ALLOW_DIRECTORY_LIST
      value: "false"
    - name: PROVIDE_INDEX_PAGE
      value: "false"
    - name: AWS_ACCESS_KEY_ID
      valueFrom:
        secretKeyRef:
          name: my-secret
          key: AWS_ACCESS_KEY_ID
    - name: AWS_SECRET_ACCESS_KEY
      valueFrom:
        secretKeyRef:
          name: my-secret
          key: AWS_SECRET_ACCESS_KEY
@eanikindfi
Copy link
Author

Friendly bump.
Anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant