nosduco/nforwardauth

Location header should respect X-Forwarded-Proto

Closed this issue · 1 comments

bt90 commented

The redirect only alters the scheme of the service URL. The URL of nforwardauth itself is hardcoded to http://

grafik

Could we use the same scheme for both? e.g.

    let scheme = if headers.contains_key(FORWARDED_PROTO) && !headers[FORWARDED_PROTO].is_empty()
    {
        headers[FORWARDED_PROTO].to_str().unwrap()
    } else {
        "http"
    };

    // No valid cookie/jwt found, create redirect url and return
    let mut location =
        Url::parse(format!("{}://{}/login", scheme, &Config::global().auth_host).as_str())?;

Great catch, will tackle this tonight/tomorrow. The plan was to respect it, must have slipped my mind and only respected it for the referral.