fix: route TED API to acceptance to work around production CORS (2.0.1 hotfix)#26
Merged
victoriobentivogli merged 2 commits intomainfrom Apr 7, 2026
Merged
fix: route TED API to acceptance to work around production CORS (2.0.1 hotfix)#26victoriobentivogli merged 2 commits intomainfrom
victoriobentivogli merged 2 commits intomainfrom
Conversation
The 2.0.0 rewrite introduced a host-based switch in tedAPI.js that selects api.ted.europa.eu when running on docs.ted.europa.eu or data.ted.europa.eu, falling back to api.acceptance.ted.europa.eu elsewhere. The production API does not allow CORS from docs.ted.europa.eu, so the procedure timeline silently fails to load in production with a preflight error. Version 1.0.0 unconditionally used the acceptance API in production and worked. This hotfix restores that behaviour: always use the acceptance API, regardless of host. Adds CORS_REQUEST.md at the repo root — a short operational request to forward to the TED API administrators asking them to enable CORS for docs.ted.europa.eu on api.ted.europa.eu. Once that lands, the host switch can be reintroduced and this hotfix reverted. Bumps version to 2.0.1.
victoriobentivogli
approved these changes
Apr 7, 2026
Collaborator
victoriobentivogli
left a comment
There was a problem hiding this comment.
OK. Tested as instructed.
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.
What this fixes
The 2.0.0 rewrite introduced a host-based switch in
tedAPI.jsthat points the procedure-timeline API calls atapi.ted.europa.euwhen running ondocs.ted.europa.euordata.ted.europa.eu, and atapi.acceptance.ted.europa.eueverywhere else. The production API does not allow CORS fromdocs.ted.europa.eu, so on production:Console error:
Why 1.0.0 didn't have this bug
Version 1.0.0 had
VITE_TED_API="https://api.acceptance.ted.europa.eu/v3"in both.env.productionand.env.development— it unconditionally used the acceptance API. The acceptance API allows CORS fromdocs.ted.europa.eu. The 2.0.0 host switch is the only thing that changed the behaviour.What this PR does
tedAPI.js. Always usehttps://api.acceptance.ted.europa.eu/v3. This restores parity with 1.0.0.CORS_REQUEST.mdat the repo root — a short operational request to forward to the TED API administrators asking them to enable CORS fordocs.ted.europa.euonapi.ted.europa.eu. Once that lands, the host switch can be reintroduced and this hotfix reverted.Test plan
npm test→ 123/123 passingnpm start, navigates to a notice, confirms the procedure timeline loads (it does in dev — same as before, dev never used the production API anyway)docs.ted.europa.eu, navigate to a notice (e.g. https://docs.ted.europa.eu/ted-open-data-explorer/?facet=%7B%22type%22%3A%22notice-number%22%2C%22value%22%3A%2200172531-2026%22%7D), confirm the procedure timeline appears and the console is free of CORS errorsCORS_REQUEST.mdto the TED API admins