Skip to content

Commit 8edeae2

Browse files
tomdesairTom Desair
authored andcommitted
Return relative Location header values in order to support HTTPS proxy servers
1 parent ab1417c commit 8edeae2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/java/me/desair/tus/server/creation/CreationPostRequestHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public void process(HttpMethod method, TusServletRequest servletRequest,
3939
info = uploadStorageService.create(info, ownerKey);
4040

4141
//We've already validated that the current request URL matches our upload URL so we can safely use it.
42-
String url = servletRequest.getRequestURL().append("/").append(info.getId()).toString();
42+
String uploadURI = servletRequest.getRequestURI();
43+
String url = uploadURI + (StringUtils.endsWith(uploadURI, "/") ? "" : "/") + info.getId();
4344
servletResponse.setHeader(HttpHeader.LOCATION, url);
4445
servletResponse.setStatus(HttpServletResponse.SC_CREATED);
4546

src/test/java/me/desair/tus/server/creation/ITCreationExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
public class ITCreationExtension extends AbstractTusExtensionIntegrationTest {
3232

3333
private static final String UPLOAD_URI = "/test/upload";
34-
private static final String UPLOAD_URL = "http://localhost:80/test/upload/";
34+
private static final String UPLOAD_URL = UPLOAD_URI + "/";
3535

3636
private UUID id;
3737

0 commit comments

Comments
 (0)