Insecure content from markdown-it-bundle when using https

AI-generated summary

In a support thread titled ‘Insecure content from markdown-it-bundle when using https,’ mr8 reports a console error blocking the preview window when accessing their Discourse site via HTTPS. The error stems from an asset being loaded over HTTP despite the site running on HTTPS. Falco suggests enabling the force_https setting, but mr8 confirms it’s already enabled — prompting Falco to question how HTTP access is even possible if HTTPS is forced. Ultimately, mr8 resolves the issue by adding proxy_set_header X-Forwarded-Proto https; to their outer nginx configuration, which correctly signals to Discourse that HTTPS should be used for asset URLs. This fix ensures the markdown-it-bundle asset loads securely over HTTPS, allowing the preview to function normally. The issue appears to stem from misconfigured reverse proxy headers rather than Discourse settings themselves.

Recently updated my copy of discourse and noticed this weird little bug in the console that also prevents the preview window from loading.

[blocked] The page at https://domain.com/t/topic/4512/484 was not allowed to run insecure content from http://domain.com/assets/markdown-it-bundle-d1f9395746d57602322789f6d8cdbfcb43f414005bb7a41e18cb6fdbeede9796.js.

Only get this error when accessing the site via https. Accessing the site via regular http eliminates the problem and the preview loads as usual.

Did I miss a recent change somewhere in the setting that I need to adjust so that that particular asset gets loaded over https when connecting via https? All other assets seem to be loading correctly.

If you turn the site setting force_https ON, it should work, can you try that?

Already have that enabled.

If you have that enable how can you access the site via HTTP? :thinking:

Adding:

proxy_set_header X-Forwarded-Proto https;

to my outer nginx fixed this by letting discourse know that I needed the https:// assets instead of the https:// ones.