Skip to content

Commit dfc9ebe

Browse files
committed
Document cors setup
1 parent 44fdd02 commit dfc9ebe

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

docs/modules/ROOT/pages/getting-started/assembly-configuring-registry-security.adoc

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This chapter explains how to set configuration options for {registry} security.
99
* xref:registry-security-keycloak_{context}[]
1010
* xref:registry-security-azure_{context}[]
1111
* xref:registry-security-settings_{context}[]
12+
* xref:registry-cors-configuration_{context}[]
1213

1314
NOTE: For a list of all available configuration options, see {registry-config-reference}.
1415

@@ -652,3 +653,86 @@ calls to the REST API, set the following options to `true`:
652653
* For details on configuring custom authentication for {registry}, the see https://quarkus.io/guides/security-openid-connect-web-authentication[Quarkus Open ID Connect documentation]
653654

654655

656+
657+
// Metadata created by nebel
658+
659+
[id="registry-cors-configuration_{context}"]
660+
661+
== Configuring {registry} Cross-Origin Resource Sharing (CORS)
662+
663+
[role="_abstract"]
664+
Cross-Origin Resource Sharing (CORS) is a browser security feature that controls how web applications running at one origin can request resources from a different origin. {registry} includes built-in CORS support that you can configure to allow the {registry} web console or other client applications to access the {registry} REST API from different domains.
665+
666+
CORS configuration in {registry} is based on the underlying Quarkus HTTP CORS filter. By default, {registry} enables CORS and allows requests from `http://localhost:8888` and `http://127.0.0.1:8888` for local development.
667+
668+
.Prerequisites
669+
* {registry} is installed and running.
670+
671+
.Procedure
672+
673+
Configure the following environment variables to customize CORS behavior for your {registry} deployment:
674+
675+
.Configuration for {registry} CORS
676+
[.table-expandable,width="100%",cols="4,6,3",options="header"]
677+
|===
678+
|Environment variable
679+
|Description
680+
|Default
681+
682+
|`QUARKUS_HTTP_CORS`
683+
|Enables or disables the CORS filter. Set to `true` to enable CORS support.
684+
|`true`
685+
686+
|`QUARKUS_HTTP_CORS_ORIGINS`
687+
|A comma-separated list of allowed origins for CORS requests. Use `*` to allow all origins, or specify explicit origins such as `\https://my-ui.example.com`. For multiple origins, use a comma-separated list, for example: `\https://ui1.example.com,\https://ui2.example.com`.
688+
|`http://localhost:8888,http://127.0.0.1:8888`
689+
690+
|`QUARKUS_HTTP_CORS_METHODS`
691+
|A comma-separated list of HTTP methods allowed for CORS requests.
692+
|`GET,PUT,POST,PATCH,DELETE,OPTIONS`
693+
694+
|`QUARKUS_HTTP_CORS_HEADERS`
695+
|A comma-separated list of HTTP headers allowed in CORS requests. This includes custom {registry} headers used for artifact metadata.
696+
|See note below
697+
|===
698+
699+
NOTE: The default allowed headers include: `x-registry-name`, `x-registry-name-encoded`, `x-registry-description`, `x-registry-description-encoded`, `x-registry-version`, `x-registry-artifactid`, `x-registry-artifacttype`, `x-registry-hash-algorithm`, `x-registry-content-hash`, `access-control-request-method`, `access-control-allow-credentials`, `access-control-allow-origin`, `access-control-allow-headers`, `authorization`, `content-type`, `content-encoding`, `user-agent`.
700+
701+
.Example: Allow all origins (development only)
702+
[source,yaml]
703+
----
704+
environment:
705+
QUARKUS_HTTP_CORS_ORIGINS: "*"
706+
----
707+
708+
WARNING: Using `*` to allow all origins is not recommended for production deployments. Always specify explicit allowed origins in production environments.
709+
710+
.Example: Allow specific origins (production)
711+
[source,yaml]
712+
----
713+
environment:
714+
QUARKUS_HTTP_CORS_ORIGINS: "https://registry-ui.example.com,https://admin.example.com"
715+
----
716+
717+
.Example: Kubernetes operator configuration
718+
If you are using the {registry} Operator, you can configure CORS in the `ApicurioRegistry3` custom resource:
719+
[source,yaml]
720+
----
721+
apiVersion: registry.apicur.io/v1
722+
kind: ApicurioRegistry3
723+
metadata:
724+
name: my-registry
725+
spec:
726+
app:
727+
env:
728+
- name: QUARKUS_HTTP_CORS_ORIGINS
729+
value: https://ui.example.com
730+
----
731+
732+
NOTE: When using the {registry} Operator with an Ingress configured for the UI component, the operator automatically configures CORS allowed origins based on the Ingress host. If you explicitly set `QUARKUS_HTTP_CORS_ORIGINS` in the CR, your configuration takes precedence.
733+
734+
[role="_additional-resources"]
735+
.Additional resources
736+
* For detailed information about all available Quarkus CORS configuration options, see the link:https://quarkus.io/guides/http-reference#cors-filter[Quarkus HTTP Reference - CORS Filter] documentation.
737+
738+

0 commit comments

Comments
 (0)