Skip to content

Commit

Permalink
Add a CORS preflight header (1.16.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed Nov 15, 2021
1 parent 37c5d18 commit 0eb8405
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>co.casterlabs</groupId>
<artifactId>Katana</artifactId>
<version>1.16.0</version>
<version>1.16.1</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/co/casterlabs/katana/Katana.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@Getter
public class Katana {
public static final String ERROR_HTML = "<!DOCTYPE html><html><head><title>$RESPONSECODE</title></head><body><h1>$RESPONSECODE</h1><p>$DESCRIPTION</p><br/><p><i>Running Casterlabs Katana, $ADDRESS</i></p></body></html>";
public static final String VERSION = "1.16.0";
public static final String VERSION = "1.16.1";
public static final String SERVER_DECLARATION = String.format("Katana/%s (%s)", Katana.VERSION, System.getProperty("os.name", "Generic"));

public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/co/casterlabs/katana/http/HttpRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public void stop() {
for (HttpServlet servlet : servlets) {
if (Util.regexContains(servlet.getAllowedHosts(), referer)) {
response.putHeader("Access-Control-Allow-Origin", protocol + "://" + referer);
response.putHeader("Access-Control-Allow-Method", session.getMethod().name());
this.logger.debug("Set CORS header for %s", referer);
break;
}
Expand Down

0 comments on commit 0eb8405

Please sign in to comment.