Product
개요영상그래픽문서
Enterprise
Story
레터/테크 노트소식/공지
Pricing
Ko
한국어English日本語日本語
이용 가이드
레터웍스 시작 
한국어English日本語
한국어English日本語
Preserving Content-Type Header on Files Uploaded Using S3 signed URL
2022-11-03

‍

Preserving Content-Type Header on Files Uploaded Using S3 signed URL

‍

By Hyuntaek Park

Senior full-stack engineer at Twigfarm

‍

One thing I don’t like about Amazon API Gateway is that it has a 30-second timeout. It means uploading and downloading files through API Gateway might not work very well depending on the file size or network speed. The solution is simple. You upload files directly to S3 without API Gateway.

This is not a secure way since your S3 bucket would have public access. S3 signed URL allows you to access the S3 bucket only for a specified period while the S3 bucket stays private. Many tutorials about the S3 signed URL are online and duplicating them is not the purpose of this article.

In this article, I want to share a mistake that I have made; hopefully, this article helps save your time.

‍

Architectures

Since our lambda can access to S3 and get the signed URL using JavaScript SDK: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html. Search for getSignedUrl on the page.

‍

Uploads

image

‍

Downloads

image

‍

Problem

Uploading and downloading files are smooth as butter. Now you are free from timeouts. A few gigabyte files can be handled easily. However, I found something strange after I downloaded the video file I uploaded.

image

The Content-Type header must be video/mp4. Most of the time we acknowledge the file type by reading the Content-Type header. Thus, we have to be sure the content-type header is consistent from the moment of uploading and downloading.

‍

Solution

Although I tried various parameters while invoking the getSignedUrl function, nothing really worked. But the solution was super simple.

Axios doesn’t specify the Content-Type header automatically, which I overlooked. I added the Content-Type header and it worked like a charm. I wasted too much time stupidly :).

image

Now its Content-Type is video/mp4 as it is supposed to be.

‍

I hope this article saves some time for you.


전체 목록 보기

다음 노트 살펴보기

WORKS note
월간 인공지능 2호 영상 기반 음성-텍스트 변환 솔루션 비교하기(4편_생성 결과물 비교)
2025-04-28
WORKS note
월간 인공지능 2호 영상 기반 음성-텍스트 변환 솔루션 비교하기(3편_생성 결과물 비교)
2025-04-25
WORKS note
월간 인공지능 2호 영상 기반 음성-텍스트 변환 솔루션 비교하기(2편_인터페이스 비교)
2025-04-23
이용 가이드
문의하기
(주) 트위그팜
사업자등록번호 : 556-81-00254  |  통신판매번호 : 2021-서울종로-1929
대표 : 백선호  |  개인정보관리책임자 : 박현택
서울 본사 : (03187) 서울 종로구 6(서린동) 6층
광주 지사 : (61472) 광주광역시 동구 금남로 193-22
싱가폴 아시아 지사 : (048581) 16 RAFFLES QUAY #33-07 HONG LEONG BUILDING SINGAPORE
Family site
TwigfarmLETR LABSheybunny
이용약관
|
개인정보처리방침
ⓒ 2024 LETR WORKS. All rights reserved.