DSpace 7.3 UI Update - Refused to apply style from 'dspace-theme.css' because its MIME type ('text/html')

325 views
Skip to first unread message

oriol....@udl.cat

unread,
Sep 7, 2022, 7:17:37 AM9/7/22
to DSpace Technical Support
Hi all,
Updating UI from 7.2 to 7.3, I get this error:

Refused to apply style from 'https://localhost/dspace-theme.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

And the CSS doesn't load.

I'm running DSpace 7.3 under Rocky Linux 8.5, on a Virtual Box machine.
20220907_130339.png
Thanks a lot,
Oriol

Tim Donohue

unread,
Sep 7, 2022, 12:43:09 PM9/7/22
to oriol....@udl.cat, DSpace Technical Support
Hi Oriol,

Are you able to access the stylesheet from that URL in the error message?  It appears that the UI is trying to access your CSS styles from the URL: https://localhost/dspace-theme.css

Is that the URL you expect it to be?  

Usually, in a default installation of DSpace 7, that URL would be http://localhost:4000/dspace-theme.css .  So, either you have customized your site to run on HTTPS and use port 443 (default for HTTPS) instead of port 4000, or you may have a configuration incorrect in your "config.*.yml" file.

Overall, to me, it sounds like the stylesheet may not be loading because the UI is looking for it in the wrong location.  That usually means that you have a configuration issue, likely in your "config.*.yml" file...it may be that the "ui" settings in that location are incorrect.

If you need more help, let us know on this list what other information you can figure out!

Tim


From: dspac...@googlegroups.com <dspac...@googlegroups.com> on behalf of oriol....@udl.cat <oriol....@udl.cat>
Sent: Wednesday, September 7, 2022 6:04 AM
To: DSpace Technical Support <dspac...@googlegroups.com>
Subject: [dspace-tech] DSpace 7.3 UI Update - Refused to apply style from 'dspace-theme.css' because its MIME type ('text/html')
 
--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/0aaf84b9-5a80-472a-a93f-076c843783b4n%40googlegroups.com.

Oriol Cornet Viu

unread,
Sep 8, 2022, 3:03:24 AM9/8/22
to Tim Donohue, DSpace Technical Support

Hi Tim,


Yes, my site is customized to run on HTTPS and 443. The thing is, in 7.2 UI, the same config.dev.yml file works perfectly.


This is how config.dev.yml looks like:


rest:
  ssl: true
  host: localhost*
  port: 443
  nameSpace: /server


But when I run yarn start:dev in 7.3 UI, I get that error.


*host is not really localhost, is the name of the machine (omitted for security reasons).


I am comfortable using the 7.2 UI, only I find it curious that the same configuration is not working on 7.3 UI.


Oriol

Oriol Cornet Viu

unread,
Sep 8, 2022, 3:56:10 AM9/8/22
to Tim Donohue, DSpace Technical Support

Also, this is the full output of the Chrome Console:



Oriol

Tim Donohue

unread,
Sep 12, 2022, 10:33:30 AM9/12/22
to DSpace Technical Support
Hi Oriol,

You didn't verify yet whether you can access the CSS file from _the same URL_ that appears in that error message.  That appears (to me) to be the core problem here...as I doubt that CSS file is accessible at the location specified in the "Refused to apply style from..." error message.

If that URL for the CSS file doesn't work, then that would imply either a misconfiguration or some similar sort of issue. It's hard to say where the exact problem is based on the screenshots you've sent...but I'd recommend playing with your configuration settings to see how those change the URL of the CSS file & figure out what works.  I think the problem is not in your "rest" settings, but possibly in your "ui" settings (or in the configuration of your proxy that sits in front of the UI, assuming you have a proxy).

Good luck & let us know what you find. 

Tim

Oriol Cornet Viu

unread,
Sep 14, 2022, 6:16:03 AM9/14/22
to dspac...@googlegroups.com

Hi Tim,

You're right, I couldn't access the CSS file. I tried copying it inside [dspace-source]/dist/browser/ with no success. I ended up rebuilding the source code on another folder and now it works.

Thanks a lot, Tim,

Oriol

Reply all
Reply to author
Forward
0 new messages