3

I have created bucket in S3 which consume images wit the URL

https://s3-ap-southeast-1.amazonaws.com/bodyboss-stag/app/public/spree/products/10e/original/16asdf0913_BB_GetYourBossBody_ProductImages_03-2X_eGuide-min.png?1asd474533953

How I can open this URL with my subdomain name www.images.xyz.com eg

https://images.xyz.com/bodyboss-stag/app/public/spree/products/10e/original/16asdf0913_BB_GetYourBossBody_ProductImages_03-2X_eGuide-min.png?1asd474533953

Update I followed this link https://carltonbale.com/9-hidden-features-of-amazon-s3/

and now I am able to access images with my subdomain https://images.xyz.com/bodyboss-stag/app/public/spree/products/10e/original/16asdf0913_BB_GetYourBossBody_ProductImages_03-2X_eGuide-min.png?1asd474533953

But now problem with the images which we insert from backedn via s3

 Paperclip::Attachment.default_options.merge!(
        s3_credentials: {
            access_key_id: 'XXXXXX',
            secret_access_key: 'XXXXXXXXX',
            bucket: 'images.xyz.com',
        },

        storage:        :s3,
        s3_headers:     { "Cache-Control" => "max-age=31557600" },
        s3_protocol:    "https",
        s3_region: 'Singapor',
        s3_host_name:   's3-ap-southeast-1.amazonaws.com',
        bucket:         'images.xyz.com',
    )

I tried to change s3_host_name as images.xyz.com but it gives me error

Cany anyone helps now how to setup this so that I could generate URL like images.xyz.com/rest_of_the_path

Arvind
  • 2,671
  • 1
  • 18
  • 32
  • Have a look at the consept or a wotk arond in http://stackoverflow.com/questions/18765934/how-appoint-a-subdomain-for-a-s3-bucket – Arpit Vaishnav Sep 23 '16 at 15:57
  • @ArpitVaishnav I have seen that but s3 settings are not clear , I have updated the question can you help on this – Arvind Sep 27 '16 at 06:12

1 Answers1

0

I think you may be missing the URL setting in the Paperclip.

Paperclip::Attachment.default_options.merge!(
  s3_credentials: {
    access_key_id: 'XXXXXX',
    secret_access_key: 'XXXXXXXXX',
    bucket: 'images.xyz.com',
  },

  storage:        :s3,
  s3_headers:     { "Cache-Control" => "max-age=31557600" },
  s3_protocol:    "https",
  s3_region: 'Singapor',
  s3_host_name:   's3-ap-southeast-1.amazonaws.com',
  bucket:         'images.xyz.com',
  url:            'images.xyz.com'                           
}
Adam Paca
  • 106
  • 2