Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support for outbound proxy #119

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ Instructions for both actions can be found in the README doc in the sgid-server
</div>
1. The "Login with Singpass App" interacts with the production sgid-server, whereas the "Staging" and "Development" links interact with the staging server and the local server respectively.
1. To test the sgid-test-app further, utilize sgid-mock-extension (https://github.com/datagovsg/sgid-mock-extension).

## Outbound proxy
The app will use an outbound http/https proxy if the following environment variables are defined:

- GLOBAL\_AGENT\_HTTP\_PROXY
- GLOBAL\_AGENT\_HTTPS\_PROXY
- http\_proxy
- https\_proxy
- HTTP\_PROXY
- HTTPS\_PROXY

8 changes: 8 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { PORT } from './config'
import { callback } from './routes/callback'
import { home } from './routes/home'
import { profile } from './routes/profile'
import { bootstrap } from 'global-agent'
import {getProxyAndSetupEnv} from "./proxyhelper"

const app = express()

Expand All @@ -17,4 +19,10 @@ app.get('/', home)
app.get('/callback', callback)
app.get('/profile', profile)

let proxyAddress = getProxyAndSetupEnv();
bootstrap()
if (proxyAddress) {
global.GLOBAL_AGENT.HTTP_PROXY = proxyAddress
}

app.listen(PORT, () => console.log(`listening on port ${PORT}`))
Loading