1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-08-10 22:51:31 +02:00
Files
Simmo Saan 3ac834dbcf Fix local-environment ports (#3136)
* Change Dex port in local-environment from 4190 to 5556

Port 4190 is blocked by standards-compliant browsers (e.g. Firefox), as per https://fetch.spec.whatwg.org/#port-blocking.
Port 5556 is used by Dex in its example config files: 745e1114f3/examples/config-dev.yaml (L50)

* Fix upstream in local-environment/oauth2-proxy.cfg

http://httpbin.localtest.me:8080 is only exposed to the host, not to httpbin Docker network.
Causes Bad Gateway before.

* Do not expose unauthenticated httpbin service in local-environment

This defeats the point of having oauth2-proxy.
It has already been misleading by causing the bug fixed in cafc6af48fc38f6fe4395fb0c7e2638bc84e6091.
It serves as a bad example: users might accidentally expose the service they're trying to protect in the first place.

* Remove unnecessary httpbin.localtest.me alias from local-environment
2025-07-20 20:32:50 +02:00

3.4 KiB

id, title
id title
contribution Contribution Guide

We track bugs and issues using Github.

If you find a bug, please open an Issue. When opening an Issue or Pull Request please follow the preconfigured template and take special note of the checkboxes.

If you want to fix a bug, add a new feature or extend existing functionality, please create a fork, create a feature branch and open a PR back to this repo. Please mention open bug issue number(s) within your PR if applicable.

We suggest using Visual Studio Code with the official Go for Visual Studio Code extension.

Go version

This project is currently still using go 1.22. You can follow the installation guide for go here. And you can find go version 1.22 in the archived section here.

Preparing your fork

Clone your fork, create a feature branch and update the depedencies to get started.

git clone git@github.com:<YOUR_FORK>/oauth2-proxy
cd oauth2-proxy
git branch feature/<BRANCH_NAME>
git push --set-upstream origin feature/<BRANCH_NAME>
go mod download

Testing / Debugging

For starting oauth2-proxy locally open the debugging tab and create the launch.json and select Go: Launch Package.

Debugging Tab

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch OAuth2-Proxy with Dex",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}",
            "args": [
                "--config",
                // The following configuration contains settings for a locally deployed
                // upstream and dex as an idetity provider
                "contrib/local-environment/oauth2-proxy.cfg"
            ]
        },
        {
            "name": "Launch OAuth2-Proxy with Keycloak",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}",
            "args": [
                "--config",
                // The following configuration contains settings for a locally deployed
                // upstream and keycloak as an idetity provider
                "contrib/local-environment/oauth2-proxy-keycloak.cfg"
            ]
        }
    ]
}

Before you can start your local version of oauth2-proxy, you will have to use the provided docker compose files to start a local upstream service and identity provider. We suggest using httpbin as your upstream for testing as it allows for request and response introspection of all things HTTP.

Inside the contrib/local-environment directory you can use the Makefile for starting different example setups:

  • Dex as your IdP: make up or make down
  • Dex as your IdP using the alpha-config: make alpha-config-up
  • Keycloak as your IdP: make keycloak-up
  • Dex as your IdP & nginx reverse proxy: make nginx-up
  • and many more...

Check out the Makefile to see what is available.

The username and password for all setups is usually admin@example.com and password.

The docker compose setups expose the services with a dynamic reverse DNS resolver: localtest.me