Hi everyone,
I’ve found a temporary workaround that works for me while waiting for this feature request to be implemented. Sharing in case it helps!
Disclaimer:
Please note that the following instructions involve third-party tools, and their usage may vary. Use at your own risk. I am not responsible for any issues or consequences that may arise from implementing these steps.
-
Install ngrok globally on your computer by following the instructions for your OS here.
-
Add the following code to your
wp-config.php
file:
define( 'DOCKER_HOST', $_SERVER['HTTP_X_FORWARDED_HOST'] ?? $_SERVER['HTTP_HOST'] ?? 'localhost' );
define( 'DOCKER_REQUEST_URL', ( ! empty( $_SERVER['HTTPS'] ) ? 'https://' : 'http://' ) . DOCKER_HOST );
define( 'WP_SITEURL', DOCKER_REQUEST_URL );
define( 'WP_HOME', DOCKER_REQUEST_URL );
- If using domain names with LocalWP, run this command in the terminal:
ngrok http --host-header='{yourdomainhere}' 80
- If using localhost ports, run:
ngrok http localhost:{portnumberhere}
Ngrok will provide a unique domain, creating a tunnel to access your local site without basic authentication so you can test webhooks and such.
Obviously basic authentication serves a purpose, so be careful using this workaround.