File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ cp .env.example .env
4545| ` SMTP_USER ` | SMTP username | — |
4646| ` SMTP_PASS ` | SMTP password | — |
4747| ` SMTP_FROM ` | Sender email address | ` noreply@example.com ` |
48- | ` BASE_URL ` | Public URL (used in password reset links) | auto-detected |
48+ | ` BASE_URL ` | Public URL (used in password reset links and for CORS ) | required |
4949
5050## Users & Permissions
5151
Original file line number Diff line number Diff line change @@ -15,13 +15,17 @@ var app = express();
1515
1616var PORT = process . env . PORT || 3001 ;
1717
18+ var corsOrigins = [ process . env . BASE_URL ] ;
19+
1820app . use ( cors ( {
1921 origin : async function ( origin , callback ) {
2022 if ( ! origin ) return callback ( null , true ) ;
2123
2224 var selfOrigin = 'http://localhost:' + PORT ;
2325 if ( origin === selfOrigin ) return callback ( null , true ) ;
2426
27+ if ( corsOrigins . includes ( origin ) ) return callback ( null , true ) ;
28+
2529 try {
2630 var hyperbooks = await db . allAsync (
2731 'SELECT url FROM hyperbooks WHERE url IS NOT NULL'
You can’t perform that action at this time.
0 commit comments