Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Add HTTP_X_FORWARDED_PROTO support to OAuth #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seanfahey
Copy link

A tool provider behind a load balancer that passes requests internally over http will cause a "OAuth signature check failed" error. Check for a HTTP_X_FORWARDED_PROTO and HTTP_X_FORWARDED_PORT to build a correct request. Based off https://tracker.moodle.org/browse/MDL-49171

A tool provider behind a load balancer that passes requests internally over http will cause a "OAuth signature check failed" error. Check for a HTTP_X_FORWARDED_PROTO and HTTP_X_FORWARDED_PORT to build a correct request. Based off https://tracker.moodle.org/browse/MDL-49171
@joostdekeijzer
Copy link

Hi,

We're running into the same problem: LRS behind load balancer.

In our configuration the HTTP_X_FORWARDED_PORT isn't available, so we need something like:

    if ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ) {
        $scheme = $_SERVER['HTTP_X_FORWARDED_PROTO'];

        if ( isset( $_SERVER['HTTP_X_FORWARDED_PORT'] ) ) {
            $port = $_SERVER['HTTP_X_FORWARDED_PORT'];
        } else if ( 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
            $port = 443;
        }
    }

@renaatdemuynck
Copy link

This fixes my issues as well. Can this pull request be accepted?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants