0

I have simple shell script that uses curl to get a response from a remote URL. The issue is that I migrated the said URL to HTTPS and now curl return an empty string. It seems that setting CURLOPT_SSL_VERIFYHOST option should fix the issue but how do I set this option in a shell script? Any other options / workarounds?

#! /bin/bash
URL=$(curl -u user:pass -A "Mozilla" https://example.com/ddns/update.php)
DominicM
  • 6,520
  • 13
  • 39
  • 60
  • Try `curl -L` to follow any redirects. Otherwise, use `--insecure` to disable the SSL check – 0stone0 Mar 20 '20 at 18:56
  • @0stone0 That did not work, but I noticed I am getting Error 500 in browser, any clue why seeing as this is after login? Is it expected for curl to return empty for server errors? – DominicM Mar 20 '20 at 21:50

1 Answers1

0

Today, I happened to have the same issue. neither -k and --insecure nor -L worked, but then for some reason I mixed them and it worked.

I can't say why that happened, but this worked for me:

curl -kL https://...

PS: it was a Jupyter notebook server. my guess is that it uses both ssl and redirection.

Yılmaz Durmaz
  • 2,374
  • 12
  • 26