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

use "curl -L" to follow redirects during subdomain check #121

Merged

Conversation

@jmpesp
Copy link
Contributor

@jmpesp jmpesp commented Nov 20, 2018

also write out http_code to avoid using grep to check for 200

also write out http_code to avoid using grep to check for 200
@nguyenfilip nguyenfilip merged commit 898f64b into loggly:master Nov 20, 2018
@OndrejCholeva
Copy link

@OndrejCholeva OndrejCholeva commented Nov 20, 2018

sorry to say, but unfortunately this is not correct solution:

curl -L -s --head  --request GET invalid23424.loggly.com/login -w '%{http_code}' -o /dev/null

still outputs 200. This is due to invalid subdomain follows redirect to an error page, which surprisingly returns 200 and html code....

@jmpesp
Copy link
Contributor Author

@jmpesp jmpesp commented Nov 20, 2018

@OndrejCholeva @nguyenfilip I originally made this PR because our scripts were failing at this subdomain check step - a 302 is seen because loggly now redirects to another page for auth.

I had no idea that an invalid subdomain redirects to a valid error page! We can use curl's -w again here though, to check that the redirect isn't invalid:

$ curl -Ls -o /dev/null -w %{url_effective} invalid45862456294756239846984918345074562975.loggly.com
https://invalid45862456294756239846984918345074562975.loggly.com/accounts/invalid
$ curl -Ls -o /dev/null -w %{url_effective} testpost.loggly.com
https://my.solarwinds.cloud/login?nonce=S3DECsSQ8rbykxpC&state=eyJvcmlnaW5hdGluZ19vcmdfaWQiOiBudWxsLCAicmZwIjogIjVXY2lxeDAxYWZTaDBrWk4iLCAic3ViZG9tYWluIjogInRlc3Rwb3N0IiwgInJldHVybl9wYXRoIjogIi8ifQ%3D%3D&redirect_uri=https%3A%2F%2Fapp.loggly.com%2Fsso%2Foidc%2Fdo_sign_on&response_type=code&client_id=loggly&scope=openid+swicus

I'll make another PR with this check.

@jmpesp jmpesp deleted the jmpesp:curl_follow_redirects_for_subdomain_check branch Nov 20, 2018
@OndrejCholeva
Copy link

@OndrejCholeva OndrejCholeva commented Nov 20, 2018

@jmpesp #122 covers that already ;-) cheers.

@jmpesp
Copy link
Contributor Author

@jmpesp jmpesp commented Nov 20, 2018

Nevermind, #122 handles it :)

ninja edit: @OndrejCholeva is quicker on the draw :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.