Notes to the APP_URL

The APP_URL allows external apps to access the Shopware self-hosted. External apps are, for example, extensions that you have purchased via the Shopware Store. In a self-hosted installation, i.e. the use of Shopware on a server where you are responsible for setting up and configuring your web space yourself, the installed apps use the APP_URL to exchange information with Shopware. 


Such information can be, for example, whether the manufacturer provides app updates and whether these are compatible with the Shopware version you have installed. 


The APP_URL is used for this communication regardless of the registered account / licence domain. If you move your shop to another domain, the licence domain in the admin can differ from the APP_URL. One effect of this is that you will receive a message "Domain change detected" when you log in. In addition, errors can occur when using your apps if the APP_URL is not accessible or refers to a server with outdated information. Therefore, check the specified APP_URL when you move your shop.
The APP URL is a configuration variable that is read from the .env file. The file is always located in the root directory of your Shopware installation. In order to view and edit it, you need access via FTP or SSH. Some hosters have a call for this in their administration console. 

As of Shopware version 6.5.0.0, the described changes should be made in the .env.local file instead of the .env file.

Please note: The .env file is a hidden file. If it is not displayed to you, you must activate the display of hidden files in your tool with which you access the Shopware directory.

You can find out how to do this in the operating instructions for the software you are using or from your hoster.  
The file can be viewed and edited with any text editor. Here is an example of the abbreviated structure of the file:

APP_ENV="prod"
APP_URL="https://YOUR-DOMAIN"
DATABASE_URL="mysql://YOUR-DATABASE"
SHOPWARE_ES_HOSTS="elasticsearch:9200"
SHOPWARE_ES_ENABLED="0"
SHOPWARE_ES_INDEXING_ENABLED="0"
SHOPWARE_ES_INDEX_PREFIX="sw"
SHOPWARE_HTTP_CACHE_ENABLED="1"
SHOPWARE_HTTP_DEFAULT_TTL="7200"

...

The APP_URL is specified here in the second line.

To avoid errors, the following points should be observed:

1. accessibility

Shopware must know under which domain the store can be reached by external services. You store the desired domain during the basic setup. This domain cannot be easily changed later in the administration. By default, the domain that is stored here is the domain of the first sales channel.
You can rudimentarily check whether your domain is accessible after a change by entering the new URL as the address in your browser. If an error occurs when you confirm or the URL is changed during loading, you have not used the correct URL. Some browsers hide by default which protocol is used (http:, https:), usually http: is represented by an open lock. Alternatively, click into the address bar and press the [home] key on your keyboard. This will show you the complete URL.

2. multiple domains

If your store already uses multiple domains in your sales channel, you should use one of them as APP_URL. External systems will then communicate with your store via this domain by default.  
You will find the domains in your sales channels.

3. shop/domain moved

If you move your store to a new domain or if you have created your store within a staging environment with a different domain, you must not forget to adjust the configuration accordingly, otherwise there will be problems. Especially if the store is changed to https afterwards or if configuration files were copied and pasted.
You can check whether the licence domain is entered correctly in Settings > System > Shopware Account. You will find further information on that topic here.

4. environment variable "APP_URL

The environment variable "APP_URL" must be configured so that it points to the domain under which the store can be reached from outside. An .env file in the root directory should start with the line "APP_URL={domain}" (e.g. APP_URL=https://my-shop.com) or can be adjusted accordingly in case of changes.

5. A shop ID change is suggested

If Shopware detects changes in your system or environment that suggest the shop ID has changed, for example a changed APP_URL, the Administration opens the Shop ID change suggested dialog. Until you select an option, your shop does not communicate with apps. This prevents problems with shop identification and data corruption. The dialog shows which apps are affected and which change was detected (old and new value). Choose the option that fits your scenario:

  • Generate a new shop identifier:
    This is usually the right option if you have created a copy of your shop, e.g. a staging or test environment of a production shop, and want to use the apps in this copy as well. Shopware reinstalls the apps and registers with the app servers again using a new shop ID. Your shop then identifies itself as a new shop.

  • Uninstall apps:
    This is usually the right option if you have created a copy of your shop, e.g. a staging or test environment of a production shop, and do not want to use the apps in this copy. Shopware deletes the apps without notifying the app servers. A new shop ID is generated and your shop identifies itself as a new shop.

  • Keep the shop identifier:
    This is only the right option if you have permanently moved your live shop to a new server or environment. Shopware re-registers the apps with the same shop identifier, so they keep their data. The apps stop working in the previous installation, even if it is still running.

Caution: Never choose this option in a staging or test copy of your shop. Otherwise, the apps stop working in your live shop.

Click Confirm to apply the selected option. Click Remind me later to close the dialog for now. Until you confirm an option, there is no communication with the apps.

6. disable error message "Wrongly configured APP_URL

In production mode of your store, Shopware automatically checks if the configured APP_URL can be reached. If not, a warning message will be displayed.
If the APP_URL is configured correctly, but still does not work, you can do the following:
You can set the variable in the .env to APP_URL_CHECK_DISABLED=1. If there is no such entry, simply copy the pattern mentioned here and save it in the file .env. Important from version 6.5 the file is called .env.local.

This may cause apps to not work. In this case it is necessary that the HTTP communication between the store and the host is allowed.

Was this article helpful?

0 / 1000 characters