Want more timely Centmin Mod News Updates?
Become a Member

Install No 'Access-Control-Allow-Origin' header is present on the requested resource

Discussion in 'Install & Upgrades or Pre-Install Questions' started by computer19852007, Jul 5, 2018.

  1. computer19852007

    computer19852007 Member

    80
    8
    8
    Jun 25, 2014
    Ratings:
    +8
    Local Time:
    7:25 PM
    Centmin Mod 1.2.3-eva2000.06
    MariaDB 5.5.34
    I have use cloudfront, and i have config, but it not working

    My .conf

    Code:
    location /static/ {
        # Uncomment the following line in production mode
        expires max;
    
        # Remove signature of the static files that is used to overcome the browser cache
        location ~ ^/static/version {
            rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
        }
        location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|html|json)$ {
            add_header Cache-Control "public";
            add_header Access-Control-Allow-Origin "*";
            add_header Access-Control-Allow-Headers "Host, Content-Type, Origin, Accept";
            add_header Access-Control-Allow-Methods "GET, OPTIONS";       
            add_header X-Frame-Options "SAMEORIGIN";
            expires 30d;
    
            if (!-f $request_filename) {
                rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
            }
        }
        location ~* \.(swf|eot|ttf|otf|woff|woff2|html|json)$ {
            add_header Cache-Control "public";
            add_header Access-Control-Allow-Origin "*";
            add_header Access-Control-Allow-Headers "Host, Content-Type, Origin, Accept";
            add_header Access-Control-Allow-Methods "GET, OPTIONS";
            add_header X-Frame-Options "SAMEORIGIN";
            expires +1y;
    
            if (!-f $request_filename) {
                rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
            }
        }
        location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
            add_header Cache-Control "no-store";       
            expires    off;
    
            if (!-f $request_filename) {
               rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
            }
        }
        if (!-f $request_filename) {
            rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
        }   
        add_header Access-Control-Allow-Origin "*";
        add_header Access-Control-Allow-Headers "Host, Content-Type, Origin, Accept";
        add_header Access-Control-Allow-Methods "GET, OPTIONS";
        add_header X-Frame-Options "SAMEORIGIN";
    }
    

    Please Help me
    I have config for my Magento 2.

    Thank
     
  2. eva2000

    eva2000 Administrator Staff Member

    35,992
    7,896
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,175
    Local Time:
    10:25 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
..