How can I deploy a pdf?

OpenPdfProblem (

The folder wwwroot that I drag and drop to deploy contains the file /pdf/foo.pdf. I want this pdf to be displayed in a new tab with
<a href="pdf/foo.pdf" target="_blank">Open pdf</a>
but my Blazor app tells me

Sorry, there’s nothing at this address.

On this “Sorry”-page the Dev Tools > Sources > Page display the file foo.pdf but when I download it from there, there is no text in the file, where should be “test pdf”.

How can I deploy the pdf correctly?

Many thanks


Hey @Philipp

This is what I see when I click the Open pdf link

Hm, I did not test it on further devices before, but now. It works on my smartphone but not on private laptops (with different anti virus apps).
Any ideas what the problem could be?

Perhaps one of these apps, or a browser plugin/add-on is stopping it from loading.

I disabled my anti virus app. It is still not working.
I also tested different browsers. Chrome and Edge only show the “Sorry”-page but no message in the console.
Firefox does not show the “Sorry”-page but the following message in the console:

Unfortunately, I do not understand this message.

It works for me in Chrome. I can replicate the error in Safari.

cURL returns the following information, including showing the correct Content-Type:

% curl -IL
HTTP/2 200
accept-ranges: bytes
age: 0
cache-control: public, max-age=0, must-revalidate
content-type: application/pdf
date: Wed, 13 Apr 2022 08:38:54 GMT
etag: "39f5341745ef125ee2406ba49174afa4-ssl"
server: Netlify
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-nf-request-id: 01G0H16NTF558MKVXVXQ9MV8Z0
content-length: 37215

The error is not a browser 404, it is a message from within your app (as evident by looking at the page source—see below), which indicates your app is handling the request (at least in some instances.)

Sorry, I did not mention this. I know, it is not a browser message but from within the app:

So, it is not an anti virus problem, because it works on your machine but only for specific browsers.
But it is also not a browser problem, because it works in your Chrome but not in mine.

Any more ideas?

There is an issue within your app I might suggest. However, as I had not heard of Blazor prior to reading your original post, I cannot offer any insights as to what the cause (potentially) is, or a solution.

You might find more assistance via a Blazor-specific community.

1 Like

OK, thanks for your fast replies!

1 Like