Add production deployment guide and restrict CORS to development.
Document clearnet, TLS, and Tor setup; enable Nest CORS only in development and skip CORS_ORIGINS validation in production.
This commit is contained in:
+8
-4
@@ -8,6 +8,7 @@ import { altchaMiddleware } from './middlewares/altchaMiddleware';
|
||||
import { AltchaService } from './modules/altcha/services/AltchaService';
|
||||
import { Config } from './types/config/Config';
|
||||
import { HttpMethod } from './types/HttpMethod';
|
||||
import { NodeEnv } from './types/NodeEnv';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create<NestExpressApplication>(AppModule, { bodyParser: false });
|
||||
@@ -21,6 +22,7 @@ async function bootstrap() {
|
||||
|
||||
const {
|
||||
port,
|
||||
nodeEnv,
|
||||
corsOrigins,
|
||||
validation: {
|
||||
upload: { maxRequestBodyBytes }
|
||||
@@ -52,10 +54,12 @@ async function bootstrap() {
|
||||
})
|
||||
);
|
||||
|
||||
app.enableCors({
|
||||
origin: corsOrigins,
|
||||
credentials: true
|
||||
});
|
||||
if (nodeEnv === NodeEnv.Development) {
|
||||
app.enableCors({
|
||||
origin: corsOrigins,
|
||||
credentials: true
|
||||
});
|
||||
}
|
||||
|
||||
app.set('trust proxy', 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user