ngx_aws_auth
ngx_aws_auth copied to clipboard
getting 307 Temporary Redirect
Hi ,
I am using AuthV2 branch of this module
My nginx configuration
worker_processes 2;
pid /run/nginx.pid;
daemon off;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;
access_log access.log;
error_log error.log;
gzip on;
gzip_disable "msie6";
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
proxy_cache_lock on;
proxy_cache_lock_timeout 60s;
proxy_cache_path /data/cache levels=1:2 keys_zone=s3cache:10m max_size=30g;
server {
listen 80;
location / {
proxy_pass https://foo.s3.amazonaws.com;
aws_access_key ******************;
aws_secret_key **********************;
s3_bucket foo;
proxy_set_header Authorization $s3_auth_token;
proxy_set_header x-amz-date $aws_date;
proxy_cache s3cache;
proxy_cache_valid 200 302 5m;
}
}
}
I am getting 307 Temporary Redirect
root@mesos-slaves5:~# curl -v localhost:80
* Rebuilt URL to: localhost:21562/
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 21562 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:21562
> Accept: */*
>
< HTTP/1.1 307 Temporary Redirect
* Server nginx/1.9.3 is not blacklisted
< Server: nginx/1.9.3
< Date: Wed, 22 Jun 2016 12:23:06 GMT
< Content-Type: application/xml
< Transfer-Encoding: chunked
< Connection: keep-alive
< x-amz-bucket-region: ap-southeast-1
< x-amz-request-id: 2F4E3E6C397522BF
< x-amz-id-2: /a20dStXAYIkRKIBm1VhcF1o1xN4qZ1vqJY7OlHZF/adsadasdasdhlKpvy
< Location: https://foo.s3-ap-southeast-1.amazonaws.com/
<
<?xml version="1.0" encoding="UTF-8"?>
* Connection #0 to host localhost left intact
<Error><Code>TemporaryRedirect</Code><Message>Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.</Message><Bucket>foo</Bucket><Endpoint>foo.s3-ap-southeast-1.amazonaws.com</Endpoint><RequestId>2F4E3E6C397522BF</RequestId><HostId>/a20dStXAYIkRKIBm1VhcF1o1xN4qZ1vqJY7OlHZF/cPlPYKBXXrEAc4PnhlKpvy</HostId></Error>
Anything I am doing wrong ?
The regular vhost syntax is not supported outside of us-east. See this https://forums.aws.amazon.com/message.jspa?messageID=196878
Your bucket seems to be in the ap-southeast region.