X-forwarded-proto contains multiple protocols

I’m running into an issue with the way Glitch is setting the X-Forwarded-Proto header. For some reason, it’s being set to “https,http,http” whereas the particular server I’m using expects a single protocol. (Accessing my endpoint by http causes the header to be set to “http,http,http”.)

It’s not a standard header, but I can’t find any other examples on the web of people setting it to a comma-separated list, instead of just a single protocol.

It looks like it was added to Glitch [here](support glitch com/t/x-forwarded-proto-headers/181).

Any chance of having the behaviour changed so it’s just a single protocol?

1 Like

Hello! Thanks for pointing this out! I made a little Express middleware to workaround it. It’s not pretty but it does the trick for me — hopefully the good folks at Glitch resolve this issue soon!

module.exports = function(app) {
  app.use((req, res, next) => {
    req.headers['x-forwarded-proto'] = req.protocol;

https://github.com/ruby/ruby/commit/978ee6d1ef62b36c143103f7a229bfb8bf0f99c6 here’s an example of software coming to support a comma-separated list