luaSocket HTTP requests always respond with a redirect (301 or 302)

You are using socket.http, but try to access https URL. luasocket doesn’t handle HTTPS protocol, so it sends a request to the default port 80 instead and gets a redirect to HTTPS link (same link); this goes for several times (as the URL doesn’t really change), and in the end luasocket gives up producing the message.

The solution is to install luasec and to use ssl.https module to do the request.

Leave a Comment