Issue with Search Result URL Redirecting to "localhost"

Hello everyone,

I’m encountering an issue when conducting a search on the app. After initiating the search, the URL of the search result switches from the hostname to “localhost,” which prevents me from retrieving the page. Could anyone provide insight into resolving this issue?

Example :
localhost/index.php?action=DetailView&module=Accounts&record=3503270e-7f03-539c-1144-65e0abe55530&offset=1

Instead of :
hostname/index.php?action=DetailView&module=Accounts&record=3503270e-7f03-539c-1144-65e0abe55530&offset=1

Thank you in advance !

Please look at the site_url variable in the config.php or config_override.php

It should have your current crm url

It could also be a misconfigured web server doing an URL rewrite.

Thank you for your suggestion! I’ll check the site_url variable in both config.php and config_override.php files to ensure they have the correct CRM URL.

Just to clarify, would the process remain the same if we’re using Docker for the deployment? Or are there any specific considerations or configurations needed within the Docker environment to address this issue?

I’d like to add that the URL used to retrieve the page was pointing to my defined hostname without any changes in configuration. However, over the past two weeks, it has started redirecting to “localhost” without any apparent modification.

There are no definite answers for your questions, it depends on configurations.

First, you need to start by finding out who is changing the URL, it’s probably either SuiteCRM or the web server.

[SOLVED]
I tried what @abuzarfaris said and it worked perfectly !

In terms of configuration, I have set up SuiteCRM8 in Docker Swarm. I haven’t customized the SuiteCRM configuration files yet; the configurations are mostly done through the GUI.

Thanks for all your help!

1 Like

Hello. I see the variable correctly where you say, how do you get it to take an environment variable to replace it with the domain where it is deployed?

What are you trying to do :thinking:

Hi,
I deployed SuiteCRM using Docker, but I need the “site_url” variable, which defaults to localhost, to be automatically configured by environment, such as Vault. The problem is that it doesn’t pick up my changes, and maybe it’s just the way I have to specify how to assign the property to replace within config.php so it picks it up automatically, but there’s no way. If anyone has done something similar, I’ll be interested.
Thanks anyway.

You can dynamically write the site_url to config_override.php at container startup using an environment variable.

In your Docker Compose or deployment environment:

environment:
– SITE_URL=https://crm.example.com

Modify your Dockerfile or Entrypoint Script to inject it:

# entrypoint.sh
#!/bin/bash
set -e

# Inject dynamic site_url
if [[ -n "$SITE_URL" ]]; then
  cat <<EOF > /var/www/html/config_override.php
1 Like