Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy to clipboard button does not copy code sample correctly #7352

Closed
curtislarson opened this issue Jan 21, 2023 · 1 comment
Closed

Copy to clipboard button does not copy code sample correctly #7352

curtislarson opened this issue Jan 21, 2023 · 1 comment
Assignees
Labels
engineering Problems or updates to developers.cloudflare.com website

Comments

@curtislarson
Copy link

Example URL(s)

Actual Behavior

Clicking the copy icon in the top right of the install-tunnel.tftpl copies the following broken text to your clipboard:

# Script to install Cloudflare Tunnel and Docker resources

# Docker configuration
cd /tmpsudo apt-get install software-properties-common# Retrieving the docker repository for this OS
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
# The OS is updated and docker is installed
sudo apt update -y && sudo apt upgrade -y
sudo apt install docker docker-compose -y
# Add the HTTPBin application and run it on localhost:8080.
cat > /tmp/docker-compose.yml << "EOF"version: '3'services:  httpbin:    image: kennethreitz/httpbin    restart: always    container_name: httpbin    ports:      - 8080:80EOF

# cloudflared configuration
cd ~# Retrieve the cloudflared Linux package
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.debsudo dpkg -i cloudflared-linux-amd64.deb# Create a local user directory to temporarily hold the tunnel configuration.
mkdir ~/.cloudflaredtouch ~/.cloudflared/cert.jsontouch ~/.cloudflared/config.yml# Populate the tunnel credentials file.
cat > ~/.cloudflared/cert.json << "EOF"{    "AccountTag"   : "${account}",    "TunnelID"     : "${tunnel_id}",    "TunnelName"   : "${tunnel_name}",    "TunnelSecret" : "${secret}"}EOF
# Define the ingress rules the tunnel will use.
cat > ~/.cloudflared/config.yml << "EOF"tunnel: ${tunnel_id}credentials-file: /etc/cloudflared/cert.jsonlogfile: /var/log/cloudflared.logloglevel: info
ingress:
  - hostname: http_app.${web_zone}    service: http://localhost:8080  - hostname: "*"    service: hello-worldEOF
# Install the tunnel as a systemd service. This automatically copies cert.json to /etc/cloudfared.
sudo cloudflared service install
# The credentials file does not get copied over so we do that manually.
sudo cp -via ~/.cloudflared/cert.json /etc/cloudflared/# Start HTTPBin and start the tunnel
cd /tmpsudo docker-compose up -d && sudo systemctl start cloudflared

Expected Behavior

Manually selecting all and copying the same data gives you the correct text:

# Script to install Cloudflare Tunnel and Docker resources

# Docker configuration
cd /tmp
sudo apt-get install software-properties-common
# Retrieving the docker repository for this OS
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
# The OS is updated and docker is installed
sudo apt update -y && sudo apt upgrade -y
sudo apt install docker docker-compose -y
# Add the HTTPBin application and run it on localhost:8080.
cat > /tmp/docker-compose.yml << "EOF"
version: '3'
services:
  httpbin:
    image: kennethreitz/httpbin
    restart: always
    container_name: httpbin
    ports:
      - 8080:80
EOF

# cloudflared configuration
cd ~
# Retrieve the cloudflared Linux package
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb
# Create a local user directory to temporarily hold the tunnel configuration.
mkdir ~/.cloudflared
touch ~/.cloudflared/cert.json
touch ~/.cloudflared/config.yml
# Populate the tunnel credentials file.
cat > ~/.cloudflared/cert.json << "EOF"
{
    "AccountTag"   : "${account}",
    "TunnelID"     : "${tunnel_id}",
    "TunnelName"   : "${tunnel_name}",
    "TunnelSecret" : "${secret}"
}
EOF
# Define the ingress rules the tunnel will use.
cat > ~/.cloudflared/config.yml << "EOF"
tunnel: ${tunnel_id}
credentials-file: /etc/cloudflared/cert.json
logfile: /var/log/cloudflared.log
loglevel: info

ingress:

  - hostname: http_app.${web_zone}
    service: http://localhost:8080
  - hostname: "*"
    service: hello-world
EOF
# Install the tunnel as a systemd service. This automatically copies cert.json to /etc/cloudfared.
sudo cloudflared service install
# The credentials file does not get copied over so we do that manually.
sudo cp -via ~/.cloudflared/cert.json /etc/cloudflared/
# Start HTTPBin and start the tunnel
cd /tmp
sudo docker-compose up -d && sudo systemctl start cloudflared

Additional information

  • Tested on Chrome Version 109.0.5414.87 (Official Build) (arm64)
  • Issue also occurs on Safari Version 16.1 (18614.2.9.1.12)
@curtislarson curtislarson added the engineering Problems or updates to developers.cloudflare.com website label Jan 21, 2023
@KimJ15
Copy link
Collaborator

KimJ15 commented Jun 21, 2023

We've made some updates and it appears that this issue is now resolved (tested on Chrome and Firefox). Closing as resolved.

@KimJ15 KimJ15 closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engineering Problems or updates to developers.cloudflare.com website
Projects
None yet
Development

No branches or pull requests

3 participants