monarch-legacy
monarch-legacy copied to clipboard
fetchURL does not follow redirect
We stumble an interesting use case, we currently have the subdomain name owlsim.monarchinitiative.org redirecting to monarchinitiative.org/owlsim as a 301 redirect.
The current fetchURL method does not follow the redirect and returns the 301 error instead.
The obvious fix would be to follow the redirect, but I'm not sure that it is the best one.
Any thoughts?
An attempted fix is in https://github.com/monarch-initiative/monarch-app/pull/1187, but it is dependent upon a fix to the request
library.
Turns out that my fix works for GET, but that the request
library we are using for making calls has a bug in it with respect to redirected POSTs. I've reported it here (it is easily fixed):
- https://github.com/request/request/issues/2060
Workarounds:
- I can convert the POST to a GET, but then large POSTs will get truncated by the conversion and will fail.
- I can explore alternative libraries to
request
, which may handle this POST redirect better. Probably easy to build a Node script to exercise this. - I can fix the request bug, build a custom library, make it available somehow (npm distribution), and we'd just use that.
I'm going to wait until next week to see if the author of request
responds to my comments. This PR is on hold for now and I'm leaving the config files alone.