Env variable to customize the redirect URL
I'm trying to deploy pizzly on a single machine that hosts both my backend, frontend and the pizzly-server.
I want to avoid opening a port dedicated to pizzly and was planning instead to use nginx to redirect all traffic on port 443 to the /oauth prefix path to pizzly-server.
Unfortunately, this approach breaks because of how the redirect url is computed:
export function getPort() {
return process.env['SERVER_PORT'] != null ? +process.env['SERVER_PORT'] : 3004;
}
export function getOauthCallbackUrl() {
let port = getPort();
return (process.env['SERVER_HOST'] || 'http://localhost') + `:${port}` + '/oauth/callback';
}
For my use-case, I want the pizzly server to run on port 3004, but I want the getOauthCallbackUrl to point to port 443, since the proxy server handles redirection of traffic.
One solution would be to add a new OAUTH_CALLBACK_URL environment variable and have pizzly server use that if defined. Would that be a good idea ?
Happy to provide a fix if the env variable approach is OK.
This is a great thing to add, please feel free to add it anytime.
There was actually a AUTH_CALLBACK_URL in the .env file prior to the recent rewrite (cf. code).
#280
Resolved by https://github.com/NangoHQ/Pizzly/pull/280