choojs / bankai

:station: - friendly web compiler
Apache License 2.0
1.09k stars 102 forks source link

Using a proxy in front of Bankai fails due to too many 301 redirects #509

Closed mjstahl closed 5 years ago

mjstahl commented 5 years ago

a 🐛 bug report

Expected Behavior

Develop with Bankai, with a proxy like Ngrok or Localtunnel proxying the connection.

Current Behavior

Accessing the site causes the browser to error out due to too many redirects.

Possible Solution

lib/http-server.js httpConnection - do not redirect if the connection is already encrypted (req.connection.encrypted) or there is a x-forwarded-proto header property.

req.headers['x-forwarded-proto'] || req.connection.encrypted

Context

Developing a web app using Auth0 for authentication and user management. The passwordless option requires specifying a callback URL. localhost is not going to suffice. So I am using Ngrok to proxy the connect to the outside world (localtunnel would also work).

Your Environment

Software Version(s)
Package 9.14.0
Runtime Node 8.11.3
Package Manager npm 6.2.0
Operating System macOS 10.13.6