Skip to content

Commit 9476d8c

Browse files
authored
Include a vary: origin header (#1273)
1 parent 13490a0 commit 9476d8c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

core/common/src/main/java/org/trellisldp/common/HttpConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ public final class HttpConstants {
115115
/** The name of the HTTP response code for a Precondition Required error. */
116116
public static final int PRECONDITION_REQUIRED = 428;
117117

118+
/** The name of the HTTP request header indicating a browser's origin. */
119+
public static final String ORIGIN = "Origin";
120+
118121
/** The name of the HTTP request header used to influence what information is included in responses. */
119122
public static final String PREFER = "Prefer";
120123

core/http/src/main/java/org/trellisldp/http/impl/GetHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import static org.trellisldp.common.HttpConstants.ACCEPT_RANGES;
4848
import static org.trellisldp.common.HttpConstants.DESCRIPTION;
4949
import static org.trellisldp.common.HttpConstants.MEMENTO_DATETIME;
50+
import static org.trellisldp.common.HttpConstants.ORIGIN;
5051
import static org.trellisldp.common.HttpConstants.PREFER;
5152
import static org.trellisldp.common.HttpConstants.PREFERENCE_APPLIED;
5253
import static org.trellisldp.common.HttpConstants.RANGE;
@@ -391,6 +392,7 @@ private CompletionStage<InputStream> getBinaryStream(final IRI dsid, final Trell
391392
private String buildVaryHeader(final boolean isLdpRs) {
392393
final List<String> variants = new ArrayList<>();
393394
variants.add(ACCEPT);
395+
variants.add(ORIGIN);
394396
if (!isMemento) {
395397
variants.add(ACCEPT_DATETIME);
396398
}

0 commit comments

Comments
 (0)