kopia lustrzana https://github.com/gaul/s3proxy
Make CORS handling optional
If corsRules is null, construct the default rules. Also add HEAD method for CORS Co-authored-by: Shannon Noe <shannon.noe@drwholdings.com>pull/361/head
rodzic
48d10653c5
commit
4a6a3f2f4a
|
@ -33,9 +33,9 @@ import com.google.common.collect.Lists;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
final class CrossOriginResourceSharing {
|
final class CrossOriginResourceSharing {
|
||||||
protected static final Collection<String> SUPPORTED_METHODS =
|
protected static final Collection<String> SUPPORTED_METHODS =
|
||||||
ImmutableList.of("GET", "PUT", "POST");
|
ImmutableList.of("GET", "HEAD", "PUT", "POST");
|
||||||
|
|
||||||
private static final String HEADER_VALUE_SEPARATOR = ", ";
|
private static final String HEADER_VALUE_SEPARATOR = ", ";
|
||||||
private static final String ALLOW_ANY_ORIGIN = "*";
|
private static final String ALLOW_ANY_ORIGIN = "*";
|
||||||
|
|
|
@ -220,8 +220,14 @@ public class S3ProxyHandler {
|
||||||
AuthenticationType authenticationType, final String identity,
|
AuthenticationType authenticationType, final String identity,
|
||||||
final String credential, @Nullable String virtualHost,
|
final String credential, @Nullable String virtualHost,
|
||||||
long maxSinglePartObjectSize, long v4MaxNonChunkedRequestSize,
|
long maxSinglePartObjectSize, long v4MaxNonChunkedRequestSize,
|
||||||
boolean ignoreUnknownHeaders, CrossOriginResourceSharing corsRules,
|
boolean ignoreUnknownHeaders,
|
||||||
|
@Nullable CrossOriginResourceSharing corsRules,
|
||||||
final String servicePath, int maximumTimeSkew) {
|
final String servicePath, int maximumTimeSkew) {
|
||||||
|
if (corsRules != null) {
|
||||||
|
this.corsRules = corsRules;
|
||||||
|
} else {
|
||||||
|
this.corsRules = new CrossOriginResourceSharing();
|
||||||
|
}
|
||||||
if (authenticationType != AuthenticationType.NONE) {
|
if (authenticationType != AuthenticationType.NONE) {
|
||||||
anonymousIdentity = false;
|
anonymousIdentity = false;
|
||||||
blobStoreLocator = new BlobStoreLocator() {
|
blobStoreLocator = new BlobStoreLocator() {
|
||||||
|
@ -252,7 +258,6 @@ public class S3ProxyHandler {
|
||||||
this.maxSinglePartObjectSize = maxSinglePartObjectSize;
|
this.maxSinglePartObjectSize = maxSinglePartObjectSize;
|
||||||
this.v4MaxNonChunkedRequestSize = v4MaxNonChunkedRequestSize;
|
this.v4MaxNonChunkedRequestSize = v4MaxNonChunkedRequestSize;
|
||||||
this.ignoreUnknownHeaders = ignoreUnknownHeaders;
|
this.ignoreUnknownHeaders = ignoreUnknownHeaders;
|
||||||
this.corsRules = corsRules;
|
|
||||||
this.defaultBlobStore = blobStore;
|
this.defaultBlobStore = blobStore;
|
||||||
xmlOutputFactory.setProperty("javax.xml.stream.isRepairingNamespaces",
|
xmlOutputFactory.setProperty("javax.xml.stream.isRepairingNamespaces",
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
|
|
Ładowanie…
Reference in New Issue