Something went wrong. Try again.
Something went wrong. Try again.
2.2 kB · 88 lines
TypeScript
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889import env from '#start/env'import app from '@adonisjs/core/services/app'import { defineConfig } from '@adonisjs/core/http'
/** * The app URL can be used in various places where you want to create absolute * URLs to your application. For example, when sending emails, images should * use absolute URLs. */export const appUrl = env.get('APP_URL')
/** * The configuration settings used by the HTTP server */export const http = defineConfig({ /** * Generate a unique request id for each incoming request. * Useful to correlate logs and debug a request flow. */ generateRequestId: true,
/** * Allow HTTP method spoofing via the "_method" form/query parameter. * This lets HTML forms target PUT/PATCH/DELETE routes while still * submitting with POST. */ allowMethodSpoofing: false,
/** * Enabling async local storage will let you access HTTP context * from anywhere inside your application. */ useAsyncLocalStorage: false,
router: { matcher: 'tree', },
/** * Redirect configuration controls the behavior of * response.redirect().back() and query string forwarding. */ redirect: { /** * When enabled, all redirects automatically carry over the current * request's query string parameters to the redirect destination. * Use withQs(false) to opt out for a specific redirect. */ forwardQueryString: true, },
/** * Manage cookies configuration. The settings for the session id cookie are * defined inside the "config/session.ts" file. */ cookie: { /** * Restrict the cookie to a specific domain. * Keep empty to use the current host. */ domain: '',
/** * Restrict the cookie to a URL path. '/' means all routes. */ path: '/',
/** * Default lifetime for cookies managed by the HTTP layer. */ maxAge: '2h',
/** * Prevent JavaScript access to the cookie in the browser. */ httpOnly: true,
/** * Send cookies only over HTTPS in production. */ secure: app.inProduction,
/** * Cross-site policy for cookie sending. */ sameSite: 'lax', },})