You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Followup from #6]
TODO: intelligent redirects (and/or rel=canonical) http->https, and .com -> .net.
Want both server-side redirect from server.js and client side for GH Pages https.
Should constrain redirects to known domains, to not mess up 3rd-party forks.
Can I allow HTTP for non-SNI clients? Should I (consider #doc=secret for this case)?
Client-side could fetch redirect.js over https to be sure it works.
Should look into libs for running same routing logic on client and server.
Openshift (and probably Heroku) terminate TLS in the reverse proxy; need to check x-forwarding [https://help.openshift.com/hc/en-us/articles/203263674-What-external-ports-are-available-on-OpenShift-]
Can I allow HTTP for non-SNI clients? Should I (consider #doc=secret for this case)?
No, that's still unsafe under MitM atacks (replace JS with one leaking tho doc id).
Should I bother with giving non-SNI users a useful error page? No, because (1) they should be used to same failure mode all over the internet (2) it's not like https will entirely fail for them — they'll get wrong cert error (*.rhcloud.com) and should be able to click-through if they really want.
[2015-10-04T12:01:36.270Z] GET http undefined / < 127.12.91.1 undefined
/var/lib/openshift/55eeb1ad89f5cf2f21000102/app-root/runtime/repo/redirects.js:31
host = host.toLowerCase();
^
TypeError: Cannot call method 'toLowerCase' of undefined
at Object.computeRedirect (/var/lib/openshift/55eeb1ad89f5cf2f21000102/app-root/runtime/repo/redirects.js:31:15)
at Server.handleRequest (/var/lib/openshift/55eeb1ad89f5cf2f21000102/app-root/runtime/repo/server.coffee:27:21)
at Server.emit (events.js:117:20)
at HTTPParser.parser.onIncoming (http.js:2113:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:122:23)
at Socket.socket.ondata (http.js:1971:22)
at TCP.onread (net.js:528:27)
DEBUG: Program coffee server.coffee exited with code 8
DEBUG: Starting child process with 'coffee server.coffee'
HttpServer up, e.g. http://localhost:8080/?doc=demo
caused by haproxy not providing host header.
I need a test for that.
Uptimerobot shows the 3 redirected domains as "down" since this change.
Manual inspection shows that it's fine.
Alas, while Uptimerobot shows "reason" for previous outages, this time it doesn't.
And it doesn't clearly document how it interprets 3xx responses.
Uptimerobot uses HEAD requests, which I haven't tested.
Playing with curl raises one suspicion:
~/mathdown (gh-pages) $ curl -v -X GET -H 'Host: mathdown.com' http://mathdown.com/foo
* Hostname was NOT found in DNS cache
* Trying 54.173.37.20...
* Connected to mathdown.com (54.173.37.20) port 80 (#0)
> GET /foo HTTP/1.1
> User-Agent: curl/7.38.0
> Accept: */*
> Host: mathdown.com
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 06 Oct 2015 10:03:57 GMT
< Location: https://www.mathdown.net/foo
< Cache-control: private
< Set-Cookie: GEAR=local-55ee99710c1e662f8b000013; path=/
< Content-Length: 0
< Content-Type: text/plain
<
* Connection #0 to host mathdown.com left intact
~/mathdown (gh-pages) $ curl -v -X HEAD -H 'Host: mathdown.com' http://mathdown.com/foo
* Hostname was NOT found in DNS cache
* Trying 54.173.37.20...
* Connected to mathdown.com (54.173.37.20) port 80 (#0)
> HEAD /foo HTTP/1.1
> User-Agent: curl/7.38.0
> Accept: */*
> Host: mathdown.com
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 06 Oct 2015 10:04:06 GMT
< Location: https://www.mathdown.net/foo
< Cache-control: private
< Set-Cookie: GEAR=55ee9a9a0c1e66181b000197-mathdown; path=/
< Content-Type: text/plain
* no chunk, no close, no size. Assume close to signal end
<
* Closing connection 0
~/mathdown (gh-pages) $ curl -v --head -H 'Host: mathdown.com' http://mathdown.com/foo
* Hostname was NOT found in DNS cache
* Trying 54.173.37.20...
* Connected to mathdown.com (54.173.37.20) port 80 (#0)
> HEAD /foo HTTP/1.1
> User-Agent: curl/7.38.0
> Accept: */*
> Host: mathdown.com
>
< HTTP/1.1 301 Moved Permanently
HTTP/1.1 301 Moved Permanently
< Date: Tue, 06 Oct 2015 10:44:59 GMT
Date: Tue, 06 Oct 2015 10:44:59 GMT
< Location: https://www.mathdown.net/foo
Location: https://www.mathdown.net/foo
< Cache-control: private
Cache-control: private
< Set-Cookie: GEAR=55ee9a9a0c1e66181b000197-mathdown; path=/
Set-Cookie: GEAR=55ee9a9a0c1e66181b000197-mathdown; path=/
< Content-Type: text/plain
Content-Type: text/plain
<
* Connection #0 to host mathdown.com left intact
[OK, that's documented curl behavior:
-X, --request <command>
... This option only changes the actual word used in the HTTP request, it does not alter
the way curl behaves. So for example if you want to make a proper HEAD request, using
-X HEAD will not suffice. You need to use the -I, --head option.
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
Anyway, I tried clicking Pause and then Start on these 3 monitors, and now Uptimerobot shows them as up. Either my change still had an effect (but what?) and I just triggered a re-test (which is what I hoped to do by Pause/Start), or it was all a fluke?!
Oh well.
Also added an HTTP heroku monitor (which gets redirected) and it's also considered up.
Nah, "mathdown.net" is now considered down. Reason: "---".
Whatever.
One thing I'm now trying (short of deleting these monitors and/or using another monitoring) is using a "keyword" monitor that fetches and greps the response (ie GET instead of HEAD).
Activity
cben commentedon Feb 20, 2015
No, that's still unsafe under MitM atacks (replace JS with one leaking tho doc id).
Should I bother with giving non-SNI users a useful error page? No, because (1) they should be used to same failure mode all over the internet (2) it's not like https will entirely fail for them — they'll get wrong cert error (*.rhcloud.com) and should be able to click-through if they really want.
cben commentedon Aug 3, 2015
Due to #104 (Cloudflare serve huge (7 days) TTL on apex domains),
I'm want to redirect to www.mathdown.net as my primary domain.
cben commentedon Aug 3, 2015
How to redirect traffic to HTTPS?
anpc commentedon Aug 12, 2015
For some reason Pocket (which I use to bookmark mathdown pages)
insists on turning https://www.mathdown.net/... to http://mathdown.net/... :-(
Redirects to the secure & good domain would probably help.
Redirect http->https (on known domains), .com -> .net, apex -> www (#80…
cben commentedon Oct 4, 2015
Errors on staging-mathdown.rhcloud.com:
caused by haproxy not providing host header.
I need a test for that.
cben commentedon Oct 4, 2015
Fixed by 01e6ca9, confirmed in staging.
Pushing to prod app now.
cben commentedon Oct 4, 2015
Works in prod.
cben commentedon Oct 6, 2015
Uptimerobot shows the 3 redirected domains as "down" since this change.
Manual inspection shows that it's fine.
Alas, while Uptimerobot shows "reason" for previous outages, this time it doesn't.
And it doesn't clearly document how it interprets 3xx responses.
Uptimerobot uses HEAD requests, which I haven't tested.
Playing with curl raises one suspicion:
That
* no chunk, no close, no size. Assume close to signal endpart is suspicious. Am I doing HTTP wrong? I do callres.end()on redirects.It refers to the response not containing a
Content-Lengthor"Transfer-Encoding: chunked"header (which I do send for a GET). According to http://sourceforge.net/p/curl/bugs/1124/, these are not needed in a HEAD response — it has an intrinsic length of 0 — and curl has been fixed to understand that. Except turns out the fix applied to--headbut not to-X HEAD:[OK, that's documented curl behavior:
]
So I still don't know if uptimerobot is complaining for something real or just the fact I'm redirecting.
However, I now added a monitor for http://httpbin.org/status/301, which does send
Content-Length: 0on HEAD, and Uptimerobot seems to like it.cben commentedon Oct 6, 2015
Oh yes, I'm doing HTTP wrong. http://stackoverflow.com/a/18925736/239657:
Send Content-Length on redirects even for HEAD requests.
cben commentedon Oct 6, 2015
Deployed. The Content-Length is returned from Heroku, but RHcloud's proxie(s) are processing the response.
GET looks fine:
but HEAD loses the Content-Length:
Anyway, I tried clicking Pause and then Start on these 3 monitors, and now Uptimerobot shows them as up. Either my change still had an effect (but what?) and I just triggered a re-test (which is what I hoped to do by Pause/Start), or it was all a fluke?!
Oh well.
Also added an HTTP heroku monitor (which gets redirected) and it's also considered up.
cben commentedon Oct 6, 2015
Nah, "mathdown.net" is now considered down. Reason: "---".
Whatever.
One thing I'm now trying (short of deleting these monitors and/or using another monitoring) is using a "keyword" monitor that fetches and greps the response (ie GET instead of HEAD).
cben commentedon Oct 7, 2015
Changed most monitors to "keyword" monitors doing GET.
Today:
Whatever. www.mathdown.com is clearly up, both in-browser and according to curl.
I changed Pingdom to https://mathdown.net which also involves a redirect. So far it's "up".