fix(HeritageCard): switch img src to backend proxy to avoid CORS errors#378
Open
zigzagdev wants to merge 2 commits into
Open
fix(HeritageCard): switch img src to backend proxy to avoid CORS errors#378zigzagdev wants to merge 2 commits into
zigzagdev wants to merge 2 commits into
Conversation
Replace direct UNESCO CDN URL (item.thumbnailUrl) with the backend proxy
endpoint /api/v1/heritage-image/{id}. Add isImgError state so the
placeholder SVG is shown when the proxy itself fails. Replace
referrerPolicy="no-referrer" with crossOrigin="anonymous" to pair with
the Access-Control-Allow-Origin header the proxy returns. Resolves #376.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
…ORS errors" This reverts commit 3df7d75.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
item.thumbnailUrl(直接 UNESCO CDN URL)→ バックエンドプロキシ${VITE_API_BASE_URL}/api/v1/heritage-image/${item.id}に変更referrerPolicy="no-referrer"を削除しcrossOrigin="anonymous"を追加(プロキシが返すAccess-Control-Allow-Originと対になる)useState<boolean>でisImgErrorを管理し、プロキシ失敗時にonErrorでプレースホルダー SVG を表示Why
直接 UNESCO CDN を参照すると、ブラウザの CORS/CORP 制限でブロックされる環境がある。バックエンドプロキシ経由にすることで Laravel の
HandleCorsミドルウェアが適切なヘッダーを付与し、ブロックを回避する。Test plan
imgリクエストが/api/v1/heritage-image/に向いていること関連
Closes #376
Depends on #377 (VITE_API_BASE_URL の定義)
Part of #374
🤖 Generated with Claude Code