0

I want to mask the address of a S3 hoster (not AWS) from https://s3.hoster.com/bucket-ID/file to https://s3.mydomain.com/bucket-ID/file as this is for a business project where I want my own domain without any certificate issues.

What I did so far is the following via nginx:

server {
        listen 80;
        listen [::]:80;
        server_name s3.mydomain.com;
        return 301 https://$server_name$request_uri ;
}

server {
        # SSL configuration
        listen 443 ssl;
        listen [::]:443 ssl;        # ssl on;
        ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
        server_name s3.mydomain.com;        set $cors '' ;
        if ($http_origin ~* (.*\.mydomain\.com)) {
                set $cors 'true' ;
        }        # add security header SC-1147
        add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' blob: data: https://$server_name ";
        add_header Referrer-Policy "same-origin";
        add_header Feature-Policy "vibrate 'self' ; speaker * ; fullscreen *; sync-xhr 'self' ; notifications 'self' ; push 'self' ; geolocation 'self'; midi 'self'; microphone 'self'; camera 'self'; magnetometer 'self'; gyroscope 'self';  payment 'none'; " ;        

location / {
        proxy_cookie_domain ~ s3.hoster.com;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://s3.hoster.com;
        }
    }

This works great but all the traffic is doubled which is not helpful.

What I want to achieve is the ability to use my domain for the bucket and just relay it in some way to the hosters domain. When changing the hoster I don't need to change all domains but just the relay or rewrite in some way.

Can this easily be made or do I need some specialised software or does it not work at all? At the current hoster I can't make any changes at all but creating and deleting buckets.

DavidJ
  • 1
  • 2

0 Answers0