Forum Discussion

Subrun's avatar
Subrun
Icon for Cirrostratus rankCirrostratus
Apr 15, 2019

How to run GET command in F5 CLI

Hello All,

 

Probably one of the silly question.

 

GET /index.html HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close , i want to run this send string command from CLI of F5 to see in reply what output in return I am getting.

 

When I run this command from CLI it does not show any output instead it is stuck at CLI ?

 

Whats wrong I am doing ?

 

3 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    printf "GET /index.html HTTP/1.1\r\nHost: host.domian.com\r\nConnection: Close\r\n\r\n" | nc host.domian.com port_no

  • Hi Subrun,

    you may take one of the CLI commands below...

    Sending a HTTP request using default Route Domain use this command:

    printf 'GET / HTTP/1.1\r\nHost: www.domain.de\r\nConnection: Close\r\n\r\n' | nc 1.2.3.4 80
    

    Sending a HTTPS request using default Route Domain use this command:

    printf 'GET / HTTP/1.1\r\nHost: www.domain.de\r\nConnection: Close\r\n\r\n' | openssl s_client -quiet -host 1.2.3.4 -port 443 
    

    Sending a HTTP request using Route Domain %10 use this command:

    rdexec 10 printf 'GET / HTTP/1.1\r\nHost: www.domain.de\r\nConnection: Close\r\n\r\n' | nc 1.2.3.4 80
    

    Sending a HTTPS request using Route Domain %20 use this command:

    rdexec 20 printf 'GET / HTTP/1.1\r\nHost: www.domain.de\r\nConnection: Close\r\n\r\n' | openssl s_client -quiet -host 1.2.3.4 -port 443 
    

    Cheers, Kai

  • Hi,

    the simplest solution is to use curl which is supported by F5:

    curl -i -k https://1.1.1.1.1/index.html -H "Host: host.domain.com"

    • -i : see header in response
    • -k : ignore ssl erro
    • -H : insert header
    • 1.1.1.1 --> set you backend IP

    For more info:

    https://ec.haxx.se/cmdline-options.html

    regards.