Skip to content
This repository was archived by the owner on Dec 3, 2023. It is now read-only.

アイコン画像を nginx で配信する#9

Open
tatsuru wants to merge 1 commit into
mainfrom
serve-icon-nginx
Open

アイコン画像を nginx で配信する#9
tatsuru wants to merge 1 commit into
mainfrom
serve-icon-nginx

Conversation

@tatsuru

@tatsuru tatsuru commented Nov 25, 2023

Copy link
Copy Markdown
Owner

前提

https://gist.github.com/kazeburo/70b352e6d51969b214f919bcf0794ba6#%E3%82%A2%E3%82%A4%E3%82%B3%E3%83%B3%E7%94%BB%E5%83%8F%E9%85%8D%E4%BF%A1%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E7%89%B9%E8%A8%98%E4%BA%8B%E9%A0%85

  • Etag じゃなくこの sha256 で渡してくるので、キャッシュから返す場合は比較ロジックが必要

作戦

  • アイコンアップロート時にディレクトリに書き出す
    • ファイル名 /home/isucon/isucon13/images/{{sha256}}.{{ext}}
    • あとで:DBに書くのは sha256 だけでよくなるはず
  • nginx でファイルが存在したら返すようにする
    • ヘッダの値を取り出して存在したら返す
    • ↑のファイルにrewrite して返す

@tatsuru

tatsuru commented Nov 25, 2023

Copy link
Copy Markdown
Owner Author

あまりやりたくないので他で行けないか考える

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant