Posts

Showing posts with the label CORS

CORS with Quarkus - Example

Image
Hello everyone, today we will show you how to enable CORS support in the Quarkus application at the global level. CORS Error in Web Apps: Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. Let's learn how to enable cors in quarkus application, Quarkus comes with a CORS filter that implements the javax.servlet.Filter interface and intercepts all incoming HTTP requests. It can be enabled in the Quarkus configuration file,  application.properties: quarkus.http.cors= true quarkus.http.cors.origins= http://localhost quarkus.http.cors.methods= GET,PUT,POST quarkus.http.cors.headers= X-Custom quarkus.http.cors.exposed-headers= Content-Disposition quarkus.http.cors.access-control-max-age= 24H quarkus.http.cors.access-control-allow-credentials= true UserResource: package com.knf.dev.demo; import javax.ws.rs. GET ; import javax