Why is category.getUrl() returning incorrect subdomain? Forgive me if this is a server configuration or other issue unrelated to craft, but perhaps someone has some insight on what might be causing this, and how to fix it.

When using a simple category.getUrl() for subnav, I am getting odd results where the subdomain is not 'www', but instead something else, like 'ddd' or 'w2w'. This is only happening in the production environment. And results vary depending on which page the nav is included on. Very strange.

{% set categories = craft.categories.group(group).all() %}
{% for category in categories %}
    &lt;a href="{{ category.getUrl() }}"&gt;{{ category.title }}&lt;/a&gt;
{% endfor %}


Any ideas are much appreciated? Thank you.
Looks like the problem was using @web for the 'Base URL' setting in 'Settings > Sites'.

I replaced this with an environment variable BASE_URL="https://www.domain.com" defined in the .env file, and setting $BASE_URL in the 'Base URL' field. 

No idea why @web doesn't work reliably here, but so be it. 

Feel free to delete this question, but I thought I would leave it for others who may encounter the same problem.