• Error Access-Control-Allow-Origin

  • Thông báo lỗi bạn gặp và mọi người giúp fix.

Thông báo lỗi bạn gặp và mọi người giúp fix.
 #1728  by MacKen
 18 Aug 2018 19:49
Mình có gặp lỗi này:

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://diathevang.info' is therefore not allowed access.

Dù đã thêm : add_header X-Frame-Options ALLOWALL; trong vhost domain chính nhưng vẫn lỗi ....

Nhờ NguyenOanh chỉ giáo hộ
Get 25 USD Free To USE VPSSIM
 #1746  by MacKen
 19 Aug 2018 08:56
Lại lỗi: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://diathevang.info' is therefore not allowed access.

Lỗi trên domain phụ ...... domain chính không bị lỗi ....

Nguyen Oanh có cách nào khắc phục lỗi trên hộ mình với,, thanks
 #1748  by MacKen
 19 Aug 2018 09:24
tat cả vhost domain mình đều set:

add_header X-Frame-Options SAMEORIGIN;
add_header X-Frame-Options ALLOWALL;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";


và trong file trong file all.conf của mình thế này:
Code: Select all
location / {
 try_files $uri $uri/ /index.php?$args;
 #try_files $uri $uri/ /index.php?$query_string;
#try_files $uri $uri/ /index.php;
 # try_files $uri $uri/ /index.html;
 
      #if ($http_origin ~* (https?://[^/]*(\.)?diathevang\.info(:[0-9]+)?|https?://[^/]*(\.)?diembds\.com(:[0-9]+)?|https?://[^/]*(\.)?bdsdn\.info(:[0-9]+)?)) {
      #     add_header ‘Access-Control-Allow-Origin’ “$http_origin”;
      #}
 
}
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {              
                        ## SEOPress
                        rewrite ^/sitemaps\.xml$ /index.php?seopress_sitemap=1 last;
                        rewrite ^/sitemaps_xsl\.xsl$ /index.php?seopress_sitemap_xsl=1 last;  
                        rewrite ^/sitemaps/([_0-9a-zA-Z-]+)?\.xml$ /index.php?seopress_cpt=$1 last;
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;
}
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {              
                        ## SEOPress
                        rewrite ^/sitemaps\.xml$ /index.php?seopress_sitemap=1 last;
                        rewrite ^/sitemaps_xsl\.xsl$ /index.php?seopress_sitemap_xsl=1 last;  
                        rewrite ^/sitemaps/([_0-9a-zA-Z-]+)?\.xml$ /index.php?seopress_cpt=$1 last;
                    }             
 location ~* \.(?:ico|css|js|jpe?g|png|gif|svg|pdf|mov|mp4|mp3|eot|otf|svg|ttf|woff|woff2)$ {
    expires 7d;
    add_header Pragma public;
    add_header Cache-Control "public";
    gzip_vary on;
}
#location ~ ^/(wp-admin|wp-login\.php) {
#               allow 42.112.91.18;
#                deny all;
# } 
location ~* wp-config.php {
  deny all;
}
location /wordpress/ {
    try_files $uri $uri/ /wordpress/index.php?$args;
}
location /wp/ {
    try_files $uri $uri/ /wp/index.php?$args;
}

location /diendan/ {
    try_files $uri $uri/ /diendan/index.php?$args;
}
mình tắt hết cache

reset lại vps vẫn bị domain phụ
 #1751  by MacKen
 19 Aug 2018 09:57
#add_header X-Frame-Options SAMEORIGIN;
#add_header X-Frame-Options ALLOWALL;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";


Domain chính cã phụ đều tắt vẫn lỗi như vây
 #1754  by MacKen
 19 Aug 2018 10:03
Code: Select all
GET https://diathevang.info/wp-content/cache/min/1/wp-content/plugins/kk-star-ratings/css-2c62d0b75a78ad8242ec5640864210d5.css 404 (Not Found)
VM1917:1 Access to Font at 'https://diathevang.vn/wp-content/themes/zox-news/font-awesome/fonts/fontawesome-webfont.woff2?v=4.6.3' from origin 'https://diathevang.info' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://diathevang.info' is therefore not allowed access.
VM1917:1 Access to Font at 'https://diathevang.vn/wp-content/themes/zox-news/font-awesome/fonts/fontawesome-webfont.woff?v=4.6.3' from origin 'https://diathevang.info' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://diathevang.info' is therefore not allowed access.
(index):1 Access to Font at 'https://diathevang.vn/wp-content/themes/zox-news/font-awesome/fonts/fontawesome-webfont.ttf?v=4.6.3' from origin 'https://diathevang.info' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://diathevang.info' is therefore not allowed access.
4(index):97 GET https://diathevang.info/wp-content/cache/min/1/wp-content/plugins/theia-sticky-sidebar/js/ResizeSensor-54cebd373ce750a7df28bb6e27a7d1a1.js 404 (Not Found)
2(index):186 GET https://diathevang.info/wp-content/cache/min/1/wp-content/themes/zox-news/js/scripts-f7bd2893b0e748f389eba69101c6a055.js 404 (Not Found)
3(index):189 GET https://diathevang.info/wp-content/cache/min/1/wp-content/plugins/wpforms/assets/css/jquery.timepicker-83ec4bc8c842c51079fda80b08b02a78.css 404 (Not Found)
(index):186 GET https://diathevang.info/wp-content/cache/min/1/wp-includes/js/comment-reply-49646718d15fa901ea633eb9045fe1b4.js 404 (Not Found)
7(index):189 GET https://diathevang.info/wp-content/cache/busting/1/wp-content/plugins/wpforms/assets/js/jquery.validate.min-1.15.1.js 404 (Not Found)
(index):97 Uncaught ReferenceError: jQuery is not defined
    at (index):97
(anonymous) @ (index):97
4(index):97 GET https://diathevang.info/wp-content/cache/min/1/wp-content/plugins/theia-sticky-sidebar/js/ResizeSensor-54cebd373ce750a7df28bb6e27a7d1a1.js 404 (Not Found)
2(index):186 GET https://diathevang.info/wp-content/cache/min/1/wp-content/themes/zox-news/js/scripts-f7bd2893b0e748f389eba69101c6a055.js 404 (Not Found)
3(index):189 GET https://diathevang.info/wp-content/cache/min/1/wp-content/plugins/wpforms/assets/css/wpforms-full-396a5ec94052bec23709d7ec59d30b70.css 404 (Not Found)
(index):186 GET https://diathevang.info/wp-content/cache/min/1/wp-includes/js/comment-reply-49646718d15fa901ea633eb9045fe1b4.js 404 (Not Found)
7(index):189 GET https://diathevang.info/wp-content/cache/min/1/wp-content/plugins/wpforms/pro/assets/js/wpforms-conditional-logic-fields-d5874a021049c669999151d81392d798.js 404 (Not Found)
Get 25 USD Free To USE VPSSIM