Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

httpHeaders not applied to preflight request #1903

Open
4 tasks done
ivanpajon opened this issue Oct 21, 2024 · 2 comments
Open
4 tasks done

httpHeaders not applied to preflight request #1903

ivanpajon opened this issue Oct 21, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ivanpajon
Copy link

ivanpajon commented Oct 21, 2024

Before you start - checklist

  • I have checked if an issue is not listed in Known issues
  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

I'm setting 'Access-Control-Allow-Origin' header option in Document component to configure CORS, but it is not applied to preflight request so request fails.

PD: I saw other CORS-related issues. I know what CORS is and I have configured it in my server properly. Problem here is that httpHeaders are only applied to fetch and not to preflight request.

<Document
      file={`${fileUrl}`}
      options={{
        httpHeaders: { 'Access-Control-Allow-Origin': '*' },
      }}
/>

Steps to reproduce

Set a file link from a domain with CORS enabled

Expected behavior

Both fetch and preflight request have httpHeaders defined in component.

Actual behavior

Only fetch have httpHeaders defined in component.

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version: 9.1.0
  • React version: 18.3.1
  • Bundler name and version (if applicable):
@ivanpajon ivanpajon added the bug Something isn't working label Oct 21, 2024
@nidhi-clab
Copy link

Facing same issue, Is there any update?

@teknosains
Copy link

Facing same issue, Is there any update?

Same here

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@teknosains @ivanpajon @nidhi-clab and others