• Resolved gdevelek

    (@gdevelek)


    I have enabled it using the W3 Tocal Cache plugin, which happily reports that it passes its own built-in testing task. When I open my homepage I do see several links that point to my CloudFront distribution. However with F12 on the browser several errors appear about CORS when those CloudFront links are opened:

    (Reason: CORS request did not succeed). Status code: (null).
    (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 502

    In the W3 TC settings I have enabled the “Add CORS header” trick, but still it does not seem to help any. When I try to access a Cloudfront link with curl, I confirm that the header above is missing.

    Any clues?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @gdevelek

    Thank you for reaching out, and I am happy to help!
    You may need to check the S3 bucket configuration and check for the CORS rules in AWS to make sure they are correct
    Please check this link for more details and alo check this video for more information, and let me know if this helps!

    Thanks!

    Thread Starter gdevelek

    (@gdevelek)

    Marko, thanks for responding!

    I’m not sure why you posted the 1st video, I’m not using S3. Am I missing something?

    I followed the 2nd one, but no success. The “curl” test fails at the end, and nothing has been fixed on the browser. I use a URI that is promptly returned when I use the “proper” (non-cloudfront) DNS name in front, let’s call it wp.mycompany.com. But with the CF domain it fails with 502 as shown below.

    I tried both with “legacy cache” and with “cache policy and origin request policy”, per the video.

    I have added my proper DNS as an “alternate domain name” on the AWS, is that correct? And I have not added a CNAME in the W3TC page.

    GET /wp-content/themes/twentytwentyfour/assets/fonts/cardo/cardo_normal_400.woff2 HTTP/2
    Host: dk4l1gj24syd2.cloudfront.net
    user-agent: curl/7.68.0
    accept: /
    origin:wp.mycompany.com

    • TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
    • Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
      < HTTP/2 502
    • < content-type: text/html
    • < content-length: 507
    • < server: CloudFront
    • < date: Tue, 06 May 2025 15:26:58 GMT
    • < expires: Tue, 06 May 2025 15:26:58 GMT
    • < x-cache: Error from cloudfront
    • < via: 1.1 2e14fb9d8f93852aec2f703fe567e56c.cloudfront.net (CloudFront)
    • < x-amz-cf-pop: ATH50-C1
    • < alt-svc: h3=”:443″; ma=86400
    • < x-amz-cf-id: J5S20DqQUsq26c4H4s7AM0sGigHRto2GbYAWM2UwaemzyPp29GspJw== <
      ERROR: The request could not be satisfied
    • ERROR Failed to contact the origin.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @gdevelek

    Thank you for your feedback.
    Just to confirm, are you usign FSD CDN or asset deliver CDN? What is the CDN type you are using in the General settings and can you please sahre the website URL?
    Thanks!

    Thread Starter gdevelek

    (@gdevelek)

    Hello @vmarko ,

    I don’t know what you mean by “FSD CDN” and “asset deliver CDN”. As mentioned I’m trying to enable AWS Cloudfront. The URL is wp-test.fieldcode.com. The Cloudfront URL is dklb1gj24syd2.cloudfront.net

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problem enabling AWS Cloudfront’ is closed to new replies.