Feature request: 301 redirects

dreamobjects

#1

Ahem Mr Lund :slight_smile:

Are there any plans for implementing an object-level 301-redirect like s3?

Something like this: http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html

This would make using DreamObjects to host static sites much more attractive to me(and presumably others…).

The primary concern is handling legacy url structures, canonicalizing urls, etc. Feel free to send me a private message or email if you are interested in discussing in any more detail.

Best,
Ryan


#2

Hey Ryan,

We use Ceph for our storage cluster and it also provides the API services through it’s software called the RADOS Gateway (RGW). The RGW doesn’t yet support 301 redirects but we’ve been doing some experimentation with implementing this with HAProxy. It’s not something we’re ready to put into production, but if you’d like to test it out, here’s the relevant HAProxy configs:

[code]
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
maxconn 4096
tune.ssl.default-dh-param 2048
user haproxy
group haproxy
daemon

defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http

    option forwardfor
    option http-server-close

frontend http-in
bind *:80
bind *:443 ssl crt /etc/test-ssl/host.pem ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
reqadd X-Forwarded-Proto:\ https
option forwardfor

    # Define hosts
acl host_test hdr(host) -i test.mydomain.com

    # Figure out which one to use
use_backend test_cluster if host_test

backend test_cluster
balance leastconn
option httpclose
reqirep ^(GET|HEAD)\ (.*)/\ HTTP/1.1 \1\ \2/index.html\ HTTP/1.1
reqirep ^Host: Host:\ BUCKET.objects.dreamhost.com
server node1 BUCKET.objects.dreamhost.com:80[/code]