/file-to-pdf via api
-
Hi,
I am trying to access pdf.infragroup.ro/file-to-pdf via api but I get Cors error. If I tryin in swagger is converting the file from docx to pdf but via api it's says
I get the following error [Error] XMLHttpRequest cannot load https://pdf.infragroup.ro/pdf-to-word?outputFormat=doc due to access control checks.
[Error] AxiosError {stack: "AxiosError@https://app.mastergaz.ro/static/js/bund…://app.mastergaz.ro/static/js/bundle.js:319802:77", message: "Network Error", name: "AxiosError", code: "ERR_NETWORK", config: Object, …}
(funcție anonimă) (src_sections_dashboard_file_index_js.chunk.js:4308)
[Error] Failed to load resource: Cross-origin redirection to https://pdf.infragroup.ro/pdf-to-word denied by Cross-Origin Resource Sharing policy: Origin https://app.mastergaz.ro is not allowed by Access-Control-Allow-Origin. Status code: 302 (pdf-to-word, line 0) -
@aflorea I guess you are trying to call the API straight from your website's frontend ? If so, yes, this will trigger a CORS error.
We don't provide a way to adjust CORS headers. Usually apps have a way to adjust this but Stirling-PDF does not have a mechanism for this.
A workaround is to make your frontend call your website's backend and the backend proxies the call to Stirling-PDF.