davsclaus opened a new pull request, #30884:
URL: https://github.com/apache/camel/pull/30884

   CAMEL-17951: camel-platform-http-main - configure CORS, sessions and body 
handler flags with camel.server.* keys
   
   JIRA: https://issues.apache.org/jira/browse/CAMEL-17951
   
   ## Problem
   
   The embedded HTTP server of Camel Main (`camel.server.*`) runs on 
`VertxPlatformHttpServerConfiguration`, which has CORS,
   session and some body handler settings. Camel Main only mapped host, port, 
path, maxBodySize, file uploads, global SSL,
   authentication, static content and MCP. CORS, sessions and the other body 
handler flags could only be set in Java code,
   not in `application.properties`, environment variables or with the Camel CLI.
   
   ## Change
   
   New Camel Main options, mapped by `DefaultMainHttpServerFactory` onto the 
Vert.x server configuration (the Camel CLI uses
   the same factory, so `camel run` gets them too):
   
   - CORS: `camel.server.corsEnabled`, `corsOrigins`, `corsMethods`, 
`corsHeaders`, `corsExposedHeaders` (comma-separated
     lists), `corsAccessControlMaxAge` (seconds)
   - Sessions: `camel.server.sessionEnabled`, `sessionStoreType` (local, 
clustered), `sessionCookieName`,
     `sessionCookiePath`, `sessionTimeout`, `sessionCookieSecure`, 
`sessionCookieHttpOnly`, `sessionCookieSameSite`
     (strict, lax, none), `sessionIdMinLength`
   - Body handler: `camel.server.mergeFormAttributes`, 
`deleteUploadedFilesOnEnd`, `preallocateBodyBuffer`
   
   The names follow the flat style of the other `camel.server` options 
(`authentication*`, `jwt*`, `mcp*`, `static*`),
   with the Vert.x property names after the prefix. Kebab case 
(`camel.server.cors-enabled`) works as for every Main option.
   
   Defaults are those of `VertxPlatformHttpServerConfiguration`, except that 
the session cookie is `HttpOnly` by default
   (Vert.x and the Java configuration class default to false). Sessions were 
not configurable from Main before, so this
   changes nothing for existing users.
   
   Regenerated: the configurer, `camel-main-configuration-metadata.json`, 
`main-options.properties`, `main.adoc` and their
   catalog copies. `platform-http-main.adoc` has new CORS and Sessions sections.
   
   Spring Boot and Quarkus are not affected: they do not use `camel.server.*` 
(`camel export` already drops these keys) and
   configure CORS and sessions with their own HTTP server.
   
   ## Tests
   
   - `MainHttpServerCorsSessionTest` (Camel Main with the keys as properties): 
a CORS preflight is answered with the
     configured `Access-Control-*` headers, a foreign origin gets no 
`Access-Control-Allow-Origin`, and the session cookie
     has the configured name, path, Secure, HttpOnly and SameSite. Fails on 
main: `PropertyBinding Error binding property
     (camel.server.corsAccessControlMaxAge=3600)` and 
`(camel.server.sessionCookieName=camel-session)`.
   - `DefaultMainHttpServerFactoryTest`: mapping of every option, list 
trimming, defaults, invalid enum value.
   - camel-platform-http-main: 63 tests pass; camel-main: 366 tests pass.
   
   ## Upgrade notes
   
   None: new options only.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to