The origin values that CORS requests are allowed for, or null to allow all origins.
@param allowedOrigins Allowed origins, such as <code>https://example.org</code> or <code>http://localhost:8080</code>
@return This builder
339603
public CORSConfigBuilder withAllowedOrigins(Collection<String> allowedOrigins) {
        if (allowedOrigins != null) {
            for (String allowedOrigin : allowedOrigins) {
                if (!allowedOrigin.startsWith("http://") && !allowedOrigin.startsWith("https://")) {
                    throw new IllegalArgumentException(allowedOrigin + " is invalid: origins much have an http:// or https:// prefix");
                }
                if (allowedOrigin.lastIndexOf('/') > 8) {
                    throw new IllegalArgumentException(allowedOrigin + " is invalid: origins should not have any paths. Example origin: https://example.org");
                }
            }
        }
        this.allowedOrigins = allowedOrigins;
        return this;
    }
405740
private function _allowOrigin($request) {
        $allowOrigin = Configure::read('Cors.AllowOrigin');
        $origin = $request->getHeader('Origin');

        if ($allowOrigin === true || $allowOrigin === '*') {
            return $origin;
        }

        if (is_array($allowOrigin)) {
            $origin = (array) $origin;

            foreach ($origin as $o) {
                if (in_array($o, $allowOrigin)) {
                    return $origin;
                }
            }

            return '';
        }

        return (string)$allowOrigin;
    }
136239
public function setAllowedOrigins(array $origins): self
    {
        $this->allowedOrigins = [];

        foreach ($origins as $origin) {
            $this->allowedOrigins[\strtolower($origin)] = true;
        }

        $this->areAllOriginsAllowed = false;

        return $this;
    }
213561
public static IPAddressIntelligenceResponse allowed() {
        return builder()
            .status(IPAddressIntelligenceStatus.ALLOWED)
            .score(IPAddressIntelligenceStatus.ALLOWED.getScore())
            .build();
    }
206892
public AuthorizationCodeUriRequest.Builder authorizationCodeUri() {
    return new AuthorizationCodeUriRequest.Builder()
            .setDefaults(httpManager, scheme, host, port)
            .client_id(clientId)
            .response_type("code")
            .redirect_uri(redirectUri);
  }
193356
def allow_origin(self, request):
        # type: (BaseHttpRequest) -> str
        
        origins = self.origins
        if origins is AnyOrigin:
            return '*'
        else:
            origin = request.origin
            return origin if origin in origins else ''
1045783
public Blade enableCors(boolean enableCors, CorsConfiger corsConfig) {
        this.environment.set(ENV_KEY_CORS_ENABLE, enableCors);
        if (enableCors) {
            this.corsMiddleware = new CorsMiddleware(corsConfig);
        }
        return this;
    }
536997
private static HttpBuilder defaults(HttpBuilder builder) {
		if (defaultTimeout != null) {
			builder.timeout(defaultTimeout);
		}
		if (defaultTimeoutConnection != null) {
			builder.timeoutConnection(defaultTimeoutConnection);
		}
		if (defaultTimeoutRead != null) {
			builder.timeoutRead(defaultTimeoutRead);
		}
		if (defaultHeader != null) {
			builder.headers(defaultHeader);
		}
		return builder;
	}
1209966
function setupOriginJS(config){
  const web3Provider = new Web3.providers.HttpProvider(config.web3Url)
  // global
  web3 = new Web3(web3Provider)
  console.log(`Web3 URL: ${config.web3Url}`)

  const ipfsUrl = urllib.parse(config.ipfsUrl)
  // global
  o = new Origin({
    ipfsDomain: ipfsUrl.hostname,
    ipfsGatewayProtocol: ipfsUrl.protocol.replace(':',''),
    ipfsGatewayPort: ipfsUrl.port,
    web3
  })
  console.log(`IPFS URL: ${config.ipfsUrl}`)
}
313633
public RestBuilder enableCors() {

		Set<String> allowedHeaders = new HashSet<>();
		allowedHeaders.add("Access-Control-Allow-Origin");
		//allowedHeaders.add("Access-Control-Allow-Credentials");
		allowedHeaders.add("Access-Control-Allow-Headers");
		allowedHeaders.add("Access-Control-Allow-Methods");
		allowedHeaders.add("Access-Control-Expose-Headers");
		allowedHeaders.add("Access-Control-Request-Method");
		allowedHeaders.add("Access-Control-Request-Headers");
		//allowedHeaders.add("Access-Control-Max-Age");
		allowedHeaders.add("Origin");
		return enableCors("*", false, -1, allowedHeaders);
	}
1016735
function (callback) {
    var self = this;

    self._request({
      path: urlJoin(_urlPrefix, 'alloweddomains')
    }, function (err, body) {
      return callback(err, body.allowedDomains);
    });
  }
539605
CorsPolicy build() {
        return new CorsPolicy(origins, pathMappings, credentialsAllowed, maxAge, nullOriginAllowed,
                              exposedHeaders, allowedRequestHeaders, allowedRequestMethods,
                              preflightResponseHeadersDisabled, preflightResponseHeaders);
    }
1019797
def process_origin(
        headers: Headers, origins: Optional[Sequence[Optional[Origin]]] = None
    ) -> Optional[Origin]:
        
        # "The user agent MUST NOT include more than one Origin header field"
        # per https://tools.ietf.org/html/rfc6454#section-7.3.
        try:
            origin = cast(Origin, headers.get("Origin"))
        except MultipleValuesError:
            raise InvalidHeader("Origin", "more than one Origin header found")
        if origins is not None:
            if origin not in origins:
                raise InvalidOrigin(origin)
        return origin
1290569
public RestTemplateBuilder rootUri(String rootUri) {
		return new RestTemplateBuilder(this.detectRequestFactory, rootUri,
				this.messageConverters, this.requestFactorySupplier,
				this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
				this.restTemplateCustomizers, this.requestFactoryCustomizer,
				this.interceptors);
	}
1299129
@Override
    protected boolean shouldNotFilter(final HttpServletRequest request) throws ServletException {
        SiteContext siteContext = SiteContext.getCurrent();
        HierarchicalConfiguration config = siteContext.getConfig();
        try {
            HierarchicalConfiguration corsConfig = config.configurationAt(CONFIG_KEY);
            if (corsConfig != null) {
                return !corsConfig.getBoolean(ENABLE_KEY, false);
            }
        } catch (Exception e) {
            logger.debug("Site '{}' has no CORS configuration", siteContext.getSiteName());
        }
        return true;
    }
448357
function extractOriginHeaders_(headers) {
    const result = {
      isSameOrigin: false,
    };
    for (const key in headers) {
      if (headers.hasOwnProperty(key)) {
        const normalizedKey = key.toLowerCase();
        // for same-origin requests where the Origin header is missing, AMP sets the amp-same-origin header
        if (normalizedKey === 'amp-same-origin') {
          result.isSameOrigin = true;
          return result;
        }
        // use the origin header otherwise
        if (normalizedKey === 'origin') {
          result.origin = headers[key];
          return result;
        }
      }
    }
    return null;
  }
84627
public PublicIpMetadata sourceRestrictions(String... sourceRestrictions) {
        List<SourceRestriction> restrictions = new ArrayList<>(sourceRestrictions.length);
        Arrays.asList(sourceRestrictions).forEach(value -> restrictions.add(new SourceRestriction(value)));
        setSourceRestrictions(restrictions);
        return this;
    }