Imperva Cyber Community

 View Only
  • 1.  Website with s3 origin

    Posted 04-22-2022 01:51
    Hey everyone
    New to Imperva here and i have a very simple problem. I want to create a simple static website with s3 as its origin server. I've created a new website and added s3 hostname "cms-imperva-test.s3.amazonaws.com" as its origin. S3 bucket is public and its working fine. http://cms-imperva-test.s3.amazonaws.com/index.html but when i try imperva hostname, its giving me error "s3 bucket doesnt exist". For some reason its using website name as s3 bucket name http://84tg7yj.impervadns.net/index.html 

    <Error>
    <Code>NoSuchBucket</Code>
    <Message>The specified bucket does not exist</Message>
    <BucketName>cms-test.sport-ott.com</BucketName>
    <RequestId>QJRPXF6HPFX5N97Y</RequestId>
    <HostId>UMBT8QaUyRPSaeaBP9vBti9QJ2v3am+VVEZX0d4I3c893TFQw2SRbqnviualndonKiHwjFiFXGM=</HostId>
    </Error>
    It seems pretty straight forward but seems like im missing something. Please help.
    Regards,

    #CloudDataSecurity
    #ContentDeliveryNetwork

    ------------------------------
    Nipun Tamrakar
    Developer
    Macquarie Park NSW
    ------------------------------


  • 2.  RE: Website with s3 origin

    Posted 04-22-2022 09:28
    Hi, Nipun.

    Please see the following documentation: https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#VirtualHostingExamples 

    The bucket name must be the same as the CNAME. 

    At this point, I believe there are 2 options.

    1. Rename the bucket to match the host name being used to access it. (cms-test.sport-ott.com)
    or

          2. Implement an Imperva incaprule to rewrite the host name to the host S3 is expecting. (cms-test.sport-ott.com)


  • 3.  RE: Website with s3 origin

    Posted 04-26-2022 20:10

    Thanks for the reply Jaired.
    Bucket name has to match the hostname only if we are accessing the bucket directly as a s3 static website. If we want to access it through a cdn like cloudfront (or in this case imperva) then bucket name does not have to match the hostname. I tried your second suggestion and tried to rewrite hostname using security rules in imperva, but still couldnt make it work. Can you provide any links for the hostname rewrite ?

    Regards,



    ------------------------------
    Nipun Tamrakar
    Developer
    Macquarie Park NSW
    ------------------------------



  • 4.  RE: Website with s3 origin

    Posted 04-27-2022 02:07

    Im able to get correct response now. Based on your second suggestion. 

    Thanks a lot Jaired.



    ------------------------------
    Nipun Tamrakar
    Developer
    Macquarie Park NSW
    ------------------------------



  • 5.  RE: Website with s3 origin

    Posted 05-02-2022 09:48
    Hi Nipun,

    My apologies for the delay in responding; I was out of office.

    Glad to hear you got it working! 👍