Skip to content
Snippets Groups Projects
Unverified Commit 6c8f95c5 authored by Martin Lowe's avatar Martin Lowe :flag_ca: Committed by GitHub
Browse files

Updated CORS filter to explicitly allow all filters (#16)


* Updated CORS filter to explicitly allow all filters

Signed-off-by: Martin Lowe's avatarMartin Lowe <martin.lowe@eclipse-foundation.org>

* Add explicit CORS header filter (baked in not working as intended)

Signed-off-by: Martin Lowe's avatarMartin Lowe <martin.lowe@eclipse-foundation.org>
parent bb93045c
No related branches found
No related tags found
No related merge requests found
/**
* ***************************************************************************** Copyright (C) 2020
* Eclipse Foundation
*
* <p>This program and the accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/
*
* <p>SPDX-License-Identifier: EPL-2.0
* ****************************************************************************
*/
package org.eclipsefoundation.adopters.response;
import java.io.IOException;
import java.util.Arrays;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
import org.eclipse.microprofile.config.inject.ConfigProperty;
@Provider
public class CORSFilter implements ContainerResponseFilter {
@ConfigProperty(name = "quarkus.http.cors.exposed-headers")
String exposedHeaders;
@Override
public void filter(
ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
responseContext.getHeaders().put("Access-Control-Expose-Headers", Arrays.asList(exposedHeaders));
}
}
...@@ -4,6 +4,10 @@ org.eclipsefoundation.adopters.api.ProjectsAPI/mp-rest/url=https://projects.ecli ...@@ -4,6 +4,10 @@ org.eclipsefoundation.adopters.api.ProjectsAPI/mp-rest/url=https://projects.ecli
quarkus.http.port=8080 quarkus.http.port=8080
quarkus.http.root-path=/adopters quarkus.http.root-path=/adopters
## CORS settings
quarkus.http.cors=true
quarkus.http.cors.exposed-headers=Etag,Link,Content-Type
## Adopters raw location ## Adopters raw location
eclipse.adopters.path.json=/config/adopters.json eclipse.adopters.path.json=/config/adopters.json
%dev.eclipse.adopters.path.json=/tmp/config/adopters.json %dev.eclipse.adopters.path.json=/tmp/config/adopters.json
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment