Search code examples
javascriptshopwareshopware6

Shopware 6 Plugin: Loading failed for the <script> with the src "https://rast.swag.de/"


I'm working on a Shopware 6 project, and in my base.html.twig file, I have the following code:

{% block layout_head_javascript_tracking_swag_global %}
    <!-- ... -->
    {% if swagData.active %}
        <script>
            // ... 
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = 'https://{{ swagData.cname|trim }}';
            script.async = true;
            document.getElementsByTagName("head")[0].appendChild(script);
        </script>         
    {% endif %}
{% endblock %}

When I inspect the page in Firefox and go to the Console, I see the following error:

Loading failed for the <script> with the src "https://rast.swag.de/".

Additionally, in the Network Analysis tab, I get a GET error:

ns_error_generate_failure(ns_error_module_security,ssl_error_bad_cert_domain)

I've tried clearing the cache and restarting Firefox, but the errors persist. What could be causing these errors, and how can I resolve them?


Solution

  • The SSL certificate of https://rast.swag.de/ is not valid, because its common name does not match the domain.

    Common name of the cert of rast.swag.de

    Common name: *.webspaceconfig.de
    

    Possible required common name

    Common name: *.swag.de
    

    Your browser probably requires the SSL certificate of the site linked in the <script> tag to be valid.