News:

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

Main Menu

Theme only loads after reload

Started by Blundergod, May 25, 2024, 05:40:14 PM

Previous topic - Next topic

Blundergod

Hey everyone!

I am kind of new to SMF, but have been able to setup my forum including themes, packages, etc. I wanted to show a friend my forum and as it turns out the theme didn't load when he first opened the page. After a reload everything was working fine though. This never occured to me as the theme was probably already stored in cache. When I open my forum for the first time in an incognito browser these errors appear:

---------------------------------------------------------------------------------------------------------------
Refused to apply style from 'https://<FORUM-NAME>/?Themes/Chakra/css/minified_688d6f8460e258e692829297df3f352f.css?smf214_1716649150;PHPSESSID=gf589i16sd0ki3nsk1bv2kco3t' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Refused to execute script from 'https://<FORUM-NAME>/?PHPSESSID=gf589i16sd0ki3nsk1bv2kco3t&Themes/default/scripts/slippry.min.js?smf214_1716649150' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Refused to execute script from 'https://<FORUM-NAME>/?PHPSESSID=gf589i16sd0ki3nsk1bv2kco3t&Themes/Chakra/scripts/minified_9b8a72457ab48b06da3708677c203a59.js?smf214_1716649150' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Uncaught TypeError: jQuery(...).slippry is not a function
    at (index):169:26

Uncaught ReferenceError: smc_Toggle is not defined
    at (index):446:27
---------------------------------------------------------------------------------------------------------------

When I then reload the page everything works as expected and the errors disappear.

I get that the TypeError appears because the script which should import the .slippry function can not be executed. Buy why can this script not be executed? Is it because of the PHPSESSID inside the URL? I'm quite clueless on how to continue with this, so I'm happy about any kind of help!

The forum is hxxp:www.bangkokian.de [nonactive]
PHP version: 8.3
SMF version: 2.1.4

Sir Osis of Liver

Not sure, but don't believe 2.1.4 supports php 8.3.  Try dropping back to 8.2.  Empty forum cache in maintenance.  Clear browser cache.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Kindred

We don't support 8.3 at the moment

And your site www or not-www http or https needs to be exact.  Use htaccess to force the correct url
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Blundergod

Thanks for the replies, but it seems like the downgrade to php 8.2 didn't really change anything. I have tried the downgrade to PHP Version 8.1.28 and 8.2.28. At least everything is now correctly pointing to hxxp:www.bangkokian.de [nonactive].

TwitchisMental

Quote from: Kindred on May 25, 2024, 06:30:03 PMAnd your site www or not-www http or https needs to be exact.  Use htaccess to force the correct url
This is the most likely the cause of the issue.

You should be using https. You can use repair_settings.php to adjust this and then use .htaccess to redirect any http:// link to the https:// link.


More information can be found here - https://www.simplemachines.org/community/index.php?topic=555034.0

Blundergod

I don't quite understand why this could be a HTTPS issue. All my settings are pointing to HTTPS and there are no errors inside the logs which indicate a problem with it. It seems to just be complaining about the MIME Type checking. (I have also set the .htaccess as explained in the post)

I'm also baffled that this only appears the first time someone loads the forum, after a refresh or even if you opened the forum some time in the past everything loads correctly.

I have now also removed all my mod packages and tried various different PHP versions. What would be ultimate last step? To setup the forum from scratch?

Thanks everyone :)

Kindred

Your htaccess needs to force people to https://www.yoursite.com or https://yoursite.com

Whichever you have configured for your forum.

You have it misconfigured.
Myvinitial access goes to https://bangkokian.de  every hit after that goes to
htyps://www.bangkokian.de

That's why it's doing that
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

.htaccess in forum root -


# 301 REDIRECT HTTP TO HTTPS AND WWW TO NON-WWW
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
</IfModule>

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: