-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jetty-12.0.x' of github.com:jetty/jetty.project into je…
…tty-12.0.x
- Loading branch information
Showing
21 changed files
with
1,583 additions
and
92 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...cumentation/src/main/asciidoc/operations-guide/modules/module-cross-origin.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
[[og-module-cross-origin]] | ||
===== Module `cross-origin` | ||
|
||
The `cross-origin` module provides support for the link:https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS[CORS protocol] implemented by browsers when performing cross-origin requests. | ||
|
||
This module installs the xref:{prog-guide}#pg-server-http-handler-use-cross-origin[`CrossOriginHandler`] in the `Handler` tree; `CrossOriginHandler` inspects cross-origin requests and adds the relevant CORS response headers. | ||
|
||
`CrossOriginHandler` should be used when an application performs cross-origin requests to your server, to protect from link:https://owasp.org/www-community/attacks/csrf[cross-site request forgery] attacks. | ||
|
||
The module properties are: | ||
|
||
---- | ||
include::{jetty-home}/modules/cross-origin.mod[tags=documentation] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
jetty-core/jetty-server/src/main/config/etc/jetty-cross-origin.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd"> | ||
|
||
<Configure id="Server" class="org.eclipse.jetty.server.Server"> | ||
<Call name="insertHandler"> | ||
<Arg> | ||
<New id="CrossOriginHandler" class="org.eclipse.jetty.server.handler.CrossOriginHandler"> | ||
<Set name="allowCredentials"> | ||
<Property name="jetty.crossorigin.allowCredentials" default="true" /> | ||
</Set> | ||
<Call name="setAllowedHeaders"> | ||
<Arg type="Set"> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg> | ||
<Property name="jetty.crossorigin.allowedHeaders" default="Content-Type" /> | ||
</Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Call name="setAllowedMethods"> | ||
<Arg type="Set"> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg> | ||
<Property name="jetty.crossorigin.allowedMethods" default="GET,POST,HEAD" /> | ||
</Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Call name="setAllowedOriginPatterns"> | ||
<Arg type="Set"> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg> | ||
<Property name="jetty.crossorigin.allowedOriginPatterns" default="*" /> | ||
</Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Call name="setAllowedTimingOriginPatterns"> | ||
<Arg type="Set"> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg> | ||
<Property name="jetty.crossorigin.allowedTimingOriginPatterns" default="" /> | ||
</Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Set name="deliverPreflightRequests" property="jetty.crossorigin.deliverPreflightRequests" /> | ||
<Set name="deliverNonAllowedOriginRequests" property="jetty.crossorigin.deliverNonAllowedOriginRequests" /> | ||
<Set name="deliverNonAllowedOriginWebSocketUpgradeRequests" property="jetty.crossorigin.deliverNonAllowedOriginWebSocketUpgradeRequests" /> | ||
<Call name="setExposedHeaders"> | ||
<Arg type="Set"> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg> | ||
<Property name="jetty.crossorigin.exposedHeaders" default="" /> | ||
</Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Call name="setPreflightMaxAge"> | ||
<Arg> | ||
<Call class="java.time.Duration" name="ofSeconds"> | ||
<Arg type="long"> | ||
<Property name="jetty.crossorigin.preflightMaxAge" default="60" /> | ||
</Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
</New> | ||
</Arg> | ||
</Call> | ||
</Configure> |
Oops, something went wrong.