I just started seeing aleph start throwing some wonky handshake error on connection: Invalid handshake response getStatus: 200 OK
After digging into it, I found this: https://github.com/ztellman/aleph/issues/21 which mentioned issues with headers, so I took at look at what my headers were. It turns out, the issue here is the authorization header, but I still have no idea why. The header is this:
{"Authorization" "Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJtSjB2MENCdzF0dUhqT2pYMGpQTE9zY19oMW96WWo5WXQyeEV6SVpGeDV3In0.eyJqdGkiOiI4ZWYwYzY3My1jZjZiLTRjMmQtODQyZS1mZDY1ZjQyMTI1NmEiLCJleHAiOjE1Nzg3OTA0NzIsIm5iZiI6MCwiaWF0IjoxNTc4MTg1NjcyLCJpc3MiOiJodHRwOi8vYXV0aC5va2xldHNwbGF5LmNvbTo4MDgwL2F1dGgvcmVhbG1zL2xldHNiZXQiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiMzlkZWQwODktODIwMi00M2QxLWE4NTgtZTQ3Zjk1ZDU0ZTFiIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoicmVhbC10aW1lLXJlYWQiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiIyM2NmZGQ4NC1hMzc1LTRhZTctOTAwNC1jNjNiZWFiMGQxODAiLCJhY3IiOiIxIiwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJzY29wZSI6InByb2ZpbGUgZW1haWwiLCJjbGllbnRIb3N0IjoiMTcyLjE4LjAuMiIsImNsaWVudElkIjoicmVhbC10aW1lLXJlYWQiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2UtYWNjb3VudC1yZWFsLXRpbWUtcmVhZCIsImNsaWVudEFkZHJlc3MiOiIxNzIuMTguMC4yIiwiZW1haWwiOiJzZXJ2aWNlLWFjY291bnQtcmVhbC10aW1lLXJlYWRAcGxhY2Vob2xkZXIub3JnIn0.llQew9yXjAqajcZXVJz2LgHZN0SsEuRXD3EyW_UCK_vddOPu84_ANElypv1Z9zaa1ffTEuMrs89JyBPBRShh_xMVAAc_QpPRfGas-01Qz4WPwHk4Phs7TMv3VvBwCWRGF4V97ZxmstDs2eTKnR5-NtNiaG-Bzx87ZLHAIUV6sn0bDyhCBX3yOQRg9pPk8KH1fh40NesgRUbQP7CT6ySiT0HzS6s0dvvUdpwk8nmKdMWcoN5EF0UkdeGBcMevCaoMxzpRxU89_NpyUIqT3QKy1x0ulBHySJirRKQr2BnB8WLl25Rj071TYRbSTX5iud7MXyUtc6tQ2j7hBlLUI0TVhw"}
(yes, I'm fine sharing that JWT)
I thought it was due to length, but it's not. I can have a much longer header and it works fine. However, I've found that various tweaks to this header end up making it work. Note, though:
1. There are no new lines here (Slack's rendering is bad)
2. There is whitespace, between Bearer
and the token, but other headers (even long ones) with whitespace work fine
3. There are no non-visible chars in there (see below)
user=> (def v "Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJtSjB2MENCdzF0dUhqT2pYMGpQTE9zY19oMW96WWo5WXQyeEV6SVpGeDV3In0.eyJqdGkiOiI4ZWYwYzY3My1jZjZiLTRjMmQtODQyZS1mZDY1ZjQyMTI1NmEiLCJleHAiOjE1Nzg3OTA0NzIsIm5iZiI6MCwiaWF0IjoxNTc4MTg1NjcyLCJpc3MiOiJodHRwOi8vYXV0aC5va2xldHNwbGF5LmNvbTo4MDgwL2F1dGgvcmVhbG1zL2xldHNiZXQiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiMzlkZWQwODktODIwMi00M2QxLWE4NTgtZTQ3Zjk1ZDU0ZTFiIiwidHlwIjoiQmVh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A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z \_ \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z)
Any ideas?
Actually, if I make any change to the value (remove a single space, add a single space, remove or add single chars, lower-casing something, etc), aleph doesn't fail the handshake. Only this exact value does; is aleph doing some JWT validation on its own, which is trying to interpret this string?
Ok, crisis averted. The issue was with some other middleware we had. I'm sorry for ever doubting you, aleph.