Problem/Motivation
The "tracker.min.js" is blocked by Chrome. I noticed this in the Chrome dev tools console. The message: "blocked:mixed-content".
The site is being served via "https://example.com" but the console reports it trying to load from "http://example.com/modules/contrib/visitors/js/tracker.min.js" (http instead of https) which is why Google is blocking the script from being loaded.
My setup is probably more convoluted than others. I have a Nginx reverse proxy (which provides the https via letsencrypt) which then passes the traffic to a "drupal:11" Docker container running the site (which is apache).
Steps to reproduce
I was able to reproduce the issue on my dev machine, although the issue is not https vs http, but rather that the port being served is 8080 externally and 80 internally. The following instructions should allow you to reproduce in your own environment, provided you have docker and docker-compose installed. I'm assuming that a shell is being used.
- Create a directory "test_visitors"
- In "test_visitors" create the file "docker-compose.yml" and copy the text for the compose file (see below)
- Still in the "test_visitors" run the command: docker compose up
- Open a browser and point it to "http://localhost:8080". Setup a drupal site. Note, the database settings are, database=drupal, user=postgres, password=example, Advanced \ host=postgres, Advanced \ port=5432. The other settings shouldn't matter too much (i think), but at the end you should be logged in as the site admin.
- In another terminal window, run the command (to get to the container shell): docker exec -it drupal_test /bin/bash
- In the container shell, run the following commands:
- apt update
- apt install git -y
- composer require 'drupal/visitors:^2.x-dev'
- composer require 'drush/drush'
- drush cr
- exit
- In the Drupal admin, install visitors and then configure it.
- Load the drupal site in a browser that is not authenticated (http://localhost:8080). Open the Chrome debug console to the Network tab and notice that "tracker.min.js" does not load. Note: if you open the debug after loading the page, you will need to reload the page to see the Network populate with information.
docker-compose.yml
version: '3.1'
services:
drupal:
image: drupal:11
container_name: drupal_test
ports:
- 8080:80
volumes:
- /var/www/html/modules
- /var/www/html/profiles
- /var/www/html/themes
- /var/www/html/sites
restart: always
postgres:
image: postgres:16
environment:
POSTGRES_PASSWORD: example
restart: always
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork visitors-3494874
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
bluegeek9 commentedComment #7
bluegeek9 commentedThank you Wes!
Comment #8
wes.congruityworks.com commentedThanks Steve, your quick responses have been great.
Comment #10
bluegeek9 commentedUpdating credits.