I have a very strange issue with a Drupal 8 install. My production setup is running on NGINX in a subdirectory - something like www.example.com/abc
.
The site is running great, but I have seen an error occur that I can't pinpoint. One page that I setup as the frontpage (ie, /abc/index.php
) is made with a view that uses the Slick Carousel module to show a carousel of nodes of a certain content type (news).
Here's what's going on:
- sometimes the URL on an item of the carousel loses the
/abc
part of the path, effectively sending users away from the site (ie,/node/123
when it should be/abc/node/123
). - this happens when the user who created the node has a certain role (lower than admin). If admins create the node it doesn't happen.
- it is only visible/only affects anonymous (not logged) users. If a user is logged in, be it either admin or otherwise (including the role for who this happens), the page shows up the correct URL (ie,
/abc/node/123
). - it only happens on that page/view. In other pages/views which list the
news
content type, the same node shows the correct URL for all users, either anonymous and/or logged in. - I (admin) can solve it in at least 2 ways:
- unpublish/publish the problematic node;
- clearing the cache
- the problematic role has no way of solving this using the above methods.
Now, to add difficulty to the whole process, I have no control over the NGINX configuration, although I was told it was setup according to NGINX's Drupal recipe.
Also, in my dev environment this doesn't occur, even though the configuration settings are the same (it's exported every time I deploy to production). The only thing that might be different is the settings.php
file.
Obviously, I have no debug facilities in place for the production website, so there isn't much I can do to trace the issue. Also, there are no log messages indicating something might be wrong with this page.
I'm now trying to find a way to replicate the production environment in a VM, but even so, I'm not sure where to start looking for the problem.
Can anyone share any thoughts on this?
EDIT: I have replicated the production environment with Docker containers and I can't replicate the bug.
Meanwhile, I have seen some even weirder things happening: sometimes (again, fixable by clearing cache), the menus also get the wrong URLs - I have a block menu holding a link to the login page that instead of going to www.example.com/abc/user/login
goes to www.example.com/user/login
.
I guess clearing the cache forces the URLs to be rebuilt and apparently it gets fixed. But aren't URLs rebuilt anyway when you publish content? Why can this affect the menus as well?