Конструктор команды cors
CORS-доктор: воспроизводит обмен, который сделал бы браузер — preflight, реальный запрос и два дифференциальных зонда, — говорит, что именно браузер заблокирует, и печатает конфиг, который это чинит.
Установка модуля
$ conflux install cors
Примеры
Типичные варианты запуска: скопируйте как есть или возьмите за основу в конструкторе ниже.
$ conflux cors https://api.example.com/orders --origin https://app.example.com
$ conflux cors https://api.example.com/orders --origin https://app.example.com \$ -X POST -H "Content-Type: application/json" --credentials
$ conflux cors https://api.example.com/orders --origin https://app.example.com \$ --fix-for nginx
$ conflux cors https://api.example.com/health --origin https://app.example.com \$ --json --fail-on warning
$ conflux cors explain CORS-008
Генератор команд
Заполните форму и получите готовую команду conflux cors — в неё попадут только опции, отличающиеся от значений по умолчанию.
Запрос
Эндпоинт, origin, который отправил бы браузер, и сам запрос со страницы.
Endpoint to probe
Origin the browser would send — scheme, host and port, no trailing slash
Request body; @path reads from a file
Headers the browser would send — each non-safelisted one triggers a preflight
Режим
Режим credentials и ваша сессия Conflux.
Check in credentials mode (fetch credentials: 'include')
Attach your Conflux access token as Authorization: Bearer
Транспорт
Таймаут, TLS и протокол для зондов.
Per-probe timeout
Skip TLS certificate verification
Force HTTP/1.1
Вывод
Сниппет фикса, форматы отчёта и то, что делает код возврата ненулевым.
Config snippet to print; auto detects the stack from the Server header
What makes the exit code 1
Machine-readable output instead of the terminal report
Also write a self-contained HTML report to this path
Plain uncoloured output
$ conflux cors <url>
--origin обязателен — это origin, который отправил бы браузер, без завершающего слэша.