@@ -22,7 +22,7 @@ async function bootstrapNestApp() {
22
22
await app . listen ( PORT || 3000 ) ;
23
23
}
24
24
25
- export function configureNestApp ( app : INestApplication ) : void {
25
+ export function configureNestApp ( app : NestExpressApplication ) : void {
26
26
// Allow for base64 attachments
27
27
app . use ( json ( { limit : '50mb' } ) ) ;
28
28
@@ -41,7 +41,7 @@ export function configureNestApp(app: INestApplication): void {
41
41
app . use ( passport . session ( ) ) ;
42
42
}
43
43
44
- async function setupSwagger ( app : INestApplication ) {
44
+ async function setupSwagger ( app : NestExpressApplication ) {
45
45
const config = new DocumentBuilder ( )
46
46
. setTitle ( 'StockedUp API' )
47
47
. setDescription ( 'StockedUp API documentation' )
@@ -51,12 +51,20 @@ async function setupSwagger(app: INestApplication) {
51
51
SwaggerModule . setup ( 'api' , app , document ) ;
52
52
}
53
53
54
- async function setupSession ( app : INestApplication ) {
54
+ async function setupSession ( app : NestExpressApplication ) {
55
55
const redisStore = new RedisStore ( {
56
56
client : redisClient ,
57
57
prefix : 'session:' ,
58
58
} ) ;
59
59
60
+ const isProduction = Utils . isProduction ( ) ;
61
+
62
+ if ( isProduction ) {
63
+ // Allow for setting secure cookies via reverse proxy
64
+ // Recommended deployment way is NGINX reverse proxy
65
+ app . set ( 'trust proxy' , 1 ) ;
66
+ }
67
+
60
68
app . use (
61
69
session ( {
62
70
store : redisStore ,
0 commit comments