File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Fix loopback requests in wp-env Docker environment.
3+ #
4+ # WordPress in wp-env thinks its URL is localhost:8888, but inside the
5+ # container Apache only listens on port 80. This causes self-pinging
6+ # REST API requests (used by Cloudinary's sync daemon) to fail with
7+ # cURL error 7. Adding port 8888 to Apache resolves this.
8+ #
9+ # This script finds the wp-env WordPress container and configures Apache
10+ # to also listen on port 8888, enabling loopback requests to succeed.
11+
12+ # Find the wp-env wordpress container (exclude tests container).
13+ CONTAINER=$( docker ps --format ' {{.Names}}' | grep -E ' wordpress-1$' | grep -v tests | head -1)
14+
15+ if [ -z " $CONTAINER " ]; then
16+ echo " Warning: Could not find wp-env WordPress container. Loopback fix skipped."
17+ exit 0
18+ fi
19+
20+ # Add Listen 8888 if not already present, then graceful restart Apache.
21+ docker exec " $CONTAINER " bash -c \
22+ " grep -q 'Listen 8888' /etc/apache2/ports.conf || (echo 'Listen 8888' >> /etc/apache2/ports.conf && apache2ctl graceful)" 2> /dev/null
23+
24+ if [ $? -eq 0 ]; then
25+ echo " Loopback fix applied: Apache now also listens on port 8888 inside the container."
26+ else
27+ echo " Warning: Failed to apply loopback fix."
28+ fi
You can’t perform that action at this time.
0 commit comments