You might have already struggled with installing and configuring PWA Studio on Magento 2 project.
So today, I’ll give you a complete guide on how to change the PWA project URL of your Magento 2 project . Because the PWA server provides a long and messy server host URL.
- First of all, navigate to the file at below-mentioned path:
File: /var/www/html/magento2/pwa-studio/packages/venia-concept/.env
Navigate to the above file and open it in any editor where you can edit this.
2. So, Now look for below fields in the file and set values as required :
1. CUSTOM_ORIGIN_EXACT_DOMAIN 2. DEV_SERVER_PORT
For example, how to use and what values you can put :
First you need to check your, MAGENTO_BACKEND_URL value in same file.
Suppose, if your value in MAGENTO_BACKEND_URL=https://local.mymagento/
Than you need to set values like,
CUSTOM_ORIGIN_EXACT_DOMAIN=local.mymagento DEV_SERVER_PORT=10000
Note:
In CUSTOM_ORIGIN_EXACT_DOMAIN, any value other than the value mentioned in MAGENTO_BACKEND_URL will not work and may result in default URL or 0.0.0.0, so make sure you follow that strict. Keep Port the same as shown in the example.
Now run below commands:
- yarn run build
- yarn run watch:venia
And you’ve successfully changed URL of your PWA server host
Want to learn more further development? You might need to visit official DevDocs documentation at Official Guide Link
To see more articles related to Magento, Please Click here.