Skip to content

fix: route TED API to acceptance to work around production CORS (2.0.1 hotfix)#26

Merged
victoriobentivogli merged 2 commits intomainfrom
hotfix/2.0.1
Apr 7, 2026
Merged

fix: route TED API to acceptance to work around production CORS (2.0.1 hotfix)#26
victoriobentivogli merged 2 commits intomainfrom
hotfix/2.0.1

Conversation

@rousso
Copy link
Copy Markdown
Contributor

@rousso rousso commented Apr 7, 2026

What this fixes

The 2.0.0 rewrite introduced a host-based switch in tedAPI.js that points the procedure-timeline API calls at api.ted.europa.eu when running on docs.ted.europa.eu or data.ted.europa.eu, and at api.acceptance.ted.europa.eu everywhere else. The production API does not allow CORS from docs.ted.europa.eu, so on production:

  • The notice itself loads (the SPARQL endpoint has CORS configured)
  • The procedure timeline silently fails with a preflight error
  • Users see the RDF tree but no procurement-flow context above it

Console error:

Access to fetch at 'https://api.ted.europa.eu/v3/notices/search'
from origin 'https://docs.ted.europa.eu' has been blocked by CORS
policy: Response to preflight request doesn't pass access control
check: No 'Access-Control-Allow-Origin' header is present on the
requested resource.

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.production and .env.development — it unconditionally used the acceptance API. The acceptance API allows CORS from docs.ted.europa.eu. The 2.0.0 host switch is the only thing that changed the behaviour.

What this PR does

  1. Removes the host switch in tedAPI.js. Always use https://api.acceptance.ted.europa.eu/v3. This restores parity with 1.0.0.
  2. 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.
  3. Bumps version 2.0.0 → 2.0.1.

Test plan

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.
Copy link
Copy Markdown
Collaborator

@victoriobentivogli victoriobentivogli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Tested as instructed.

@victoriobentivogli victoriobentivogli merged commit 46dfcef into main Apr 7, 2026
1 check passed
@victoriobentivogli victoriobentivogli deleted the hotfix/2.0.1 branch April 7, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants