No stylesheets or images loading in editor


#1

I’ve just created a new account and added a new site. The editor window is showing a beautiful unstyled web page at the moment for every page.

The only clue is an error message in the console:

The resource from “https://edit.surrealcms.com/api/sites/d8123bb3-bed0-49b9-9377-ed9e6454d7b2/pages/f6f3f575-b5a0-4483-8f61-7daee32bbd0c/assets/style.css” was blocked due to MIME type (“application/json”) mismatch (X-Content-Type-Options: nosniff). render

That URL which is presumably the stylesheet that’s failing to load simply returns:

{"message":"The resource you requested was not found."}

Edit: I should mention that I’ve done all the usual disabling extensions, using a different browser+machine. Same result.


#2

Websites must be served over HTTPS in version 7, otherwise browsers block unsecure content. (A warning message is appeared in your site’s settings when the URL starts with http://.)

This is one of the biggest issues that’s holding up an automatic 5 => 7 upgrade, as many users don’t want to move their sites to HTTPS for some reason, despite browsers showing warning messages and everything else.

If your website supports SSL, simply change the URL to include https:// and it will work as expected.


#3

Thanks ^^

But it doesn’t look like that’s the problem on this occasion. The website is served only over HTTPS (HTTP requests are redirected to HTTPS). And the site is configured in Surreal with HTTPS URLs.


#4

Ah, sorry about that. That’s by far the most common cause of this.

I took a closer look and I believe this is happening because the page doesn’t have <head> section. While technically not required in HTML5, Surreal uses it to inject a <base> tag in the editor for assets resolution.

Adding the appropriate structural elements should resolve it. :slight_smile:


#5

Thanks for taking the time to dig. Always happy when the fix is easy. :grin: