-
Notifications
You must be signed in to change notification settings - Fork 337
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
Does not follow HTTP 301 redirects #156
Comments
Incidentally, this was tricky to discover because the UI spins forever. In the developer console, there is an error message that starts with
|
I ran into a lot of problems while trying to build along the lines of what is described here: It would be helpful to specify in the build instructions what version(s) of |
I ended up creating a proxy in Python to automatically do the redirects: #!/usr/bin/env python3
import subprocess
import http.server
import socketserver
import sys
PORT = 8000
URL = "http://1.3.3.7" # Where the actual service lives
class MyHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
url = URL + self.path
sys.stderr.write(url + "\n")
result = subprocess.run(["curl", "--location", url], stdout=subprocess.PIPE)
if result.returncode == 0:
self.send_response(200)
self.send_header("Content-type", "text/json")
self.end_headers()
self.wfile.write(result.stdout)
else:
self.send_response(404)
self.end_headers()
sys.stderr(f"failed when accessing {url}: {result}")
def main():
with socketserver.TCPServer(("", PORT), MyHandler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
if __name__ == "__main__":
main() |
I suspect this is because this uses Node's built-in
http
andhttps
modules, which do not supports this. Perhaps the simplest thing is to use:https://github.com/follow-redirects/follow-redirects
The text was updated successfully, but these errors were encountered: