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

Specify whether server runs behind reverse proxy #11

Merged
merged 1 commit into from
Oct 25, 2023
Merged
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
5 changes: 5 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# port on which the service will run
PORT=3005

# server base url, e.g. to construct correct email verification link
# this is the base url that end users see
BASE_URL=http://localhost:3005

# set to true if server runs behind reverse proxy (e.g. nginx)
BEHIND_PROXY=

# mailer Solid identity
# mailer needs Solid identity to authenticate with, it's set up to use Community Solid Server as identity provider
MAILER_IDENTITY_EMAIL=bot@example
Expand Down
2 changes: 2 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Router from '@koa/router'
import Koa from 'koa'
import helmet from 'koa-helmet'
import serve from 'koa-static'
import { isBehindProxy } from './config'
import {
checkVerificationLink,
finishIntegration,
Expand All @@ -15,6 +16,7 @@ import { solidAuth } from './middlewares/solidAuth'
import { validateBody } from './middlewares/validate'

const app = new Koa()
app.proxy = isBehindProxy
const router = new Router()

router
Expand Down
2 changes: 2 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ export const database: Options = {
host: process.env.DB_HOST || undefined,
port: process.env.DB_PORT ? +process.env.DB_PORT : undefined,
}

export const isBehindProxy = stringToBoolean(process.env.BEHIND_PROXY)