News:

Wondering if this will always be free?  See why free is better.

Main Menu

CORS problem with Like button

Started by smartmouse, March 22, 2020, 07:30:59 AM

Previous topic - Next topic

smartmouse

Hello, I'm using latest version of SMF 2.1 and I'm experiencing a problem with Like button.
When I try to press on "Like" nothing happens.

If I go to browser console I see this:

QuoteAccess to XMLHttpRequest at 'https://mywebsite.com/likes/?ltype=msg;sa=like;like=57746;c08e3192=efdd88eb49fc0ca02564fad54257ba4c;js=1&_=1584876372676'; from origin 'https://www.mywebsite.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
jquery.min.js:4

Cross-Origin Read Blocking (CORB) blocked cross-origin response https://mywebsite.com/likes/?ltype=msg;sa=like;like=57746;c08e3192=efdd88eb49fc0ca02564fad54257ba4c;js=1&_=1584876372676 with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.

How can I fix this?

vbgamer45

Do you have an SEO mod installed?

The issue is you have two different domains www.mywebsite.com mywebsite.com you have to set the primary url to one or the other for your SMF urls.

or you can enable CORS on your server
https://enable-cors.org/server.html
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

smartmouse

Quote from: vbgamer45 on March 22, 2020, 09:51:45 AM
Do you have an SEO mod installed?

The issue is you have two different domains www.mywebsite.com mywebsite.com you have to set the primary url to one or the other for your SMF urls.

or you can enable CORS on your server
https://enable-cors.org/server.html

Yes, I have Pretty URLs mod installed... and thanks to your message I solved!
The URL in the mod mismatch the URL of my forum.

Thank you for your help ;)

smartmouse

Quote from: vbgamer45 on March 22, 2020, 09:51:45 AM
Do you have an SEO mod installed?

The issue is you have two different domains www.mywebsite.com mywebsite.com you have to set the primary url to one or the other for your SMF urls.

or you can enable CORS on your server
https://enable-cors.org/server.html

Yes, I have Pretty URLs mod installed... and thanks to your message I solved!
The URL in the mod mismatched the URL of my forum.

Now it works. Thank you for your help ;)

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: