How to include authorization headers in RTE Path (GET) requests?

Good afternoon,
I’m having issues with the Blazor Rich Text Editor (RTE).

<SfRichTextEditor @bind-Value="Model.Optare.TBOPTARE.OPTARE_DS"
                  Height="100%"
                  CssClass="tarefa-descricao"
                  EnableResize="true"
                  AutoSaveOnIdle="true"
                  @bind-IsFullScreen="isDescricaoFullScreen">
    <RichTextEditorToolbarSettings EnableFloating="true" />
    <RichTextEditorImageSettings SaveUrl="https://localhost:7001/op/salvar-arquivo"
                                 Path="https://localhost:7001/op/buscar-arquivo" />
    <RichTextEditorEvents BeforeUploadImage="OnImageUpload"
                          ValueChange="BreafingValueChanged" />
</SfRichTextEditor>

When uploading an image, I have no issues — I can intercept the request using OnImageUpload and add a custom header (Bearer token).
However, for image GET requests, there seems to be no event or option to add a header before the request is made.

How can I intercept or customize the image GET requests made by the RTE to include my authorization header?

Thank you in advance.



3 Replies 1 reply marked as answer

VJ Vinitha Jeyakumar Syncfusion Team November 3, 2025 10:00 AM UTC

Hi ,


We’d like to clarify that our implementation exclusively uses POST requests when uploading images to the server.

Could you kindly share an example where a GET request is being used for image upload, or provide insight into how the request is being handled within the RichTextEditor? This will help us better understand the behavior and align our integration accordingly.


Regards,

Vinitha


Marked as answer

- - replied to Vinitha Jeyakumar November 5, 2025 05:21 PM UTC

"Hi Vinitha,

 

Thanks for the quick reply — I think there’s a small misunderstanding.

I’m not saying the RTE uses GET to upload images. Upload is indeed done via POST (SaveUrl) and that part works fine — I intercept the upload in BeforeUploadImage / OnImageUpload and successfully add an Authorization: Bearer <token> header to that POST.

The problem is the subsequent GET request that the RTE/browser performs to load the image after it’s been uploaded (the request to the Path URL). The RTE inserts an <img src="..."> pointing to the Path (or uses the url returned by SaveUrl), and the browser performs a plain GET to fetch the image. There’s no RTE event or client-side hook that lets me attach a custom header to that GET (and browsers do not allow adding arbitrary headers to normal img requests).

Example (RTE snippet):

<RichTextEditorImageSettings 
    SaveUrl="/api/op/salvar-arquivo"
    RemoveUrl="/api/op/remover-arquivo"
    Path="/api/op/buscar-arquivo/" />

Flow:

  1. RTE does POST /api/op/salvar-arquivo — I intercept and add Authorization header here, upload succeeds.
  2. Server returns the file name / url.
  3. RTE inserts an <img src="/api/op/buscar-arquivo/<generated-name>">.
  4. Browser performs GET /api/op/buscar-arquivo/<generated-name> without my custom header, and I have no RTE event to add it.

Because of that, if my GET endpoint requires Authorization: Bearer ..., the image load fails. My ask is: is there any supported way in the RTE to (a) attach headers to the GET request used to load the image, or (b) provide some client-side hook so I can customize how the image is fetched (for example using fetch/XHR with headers and then create an object URL)? If neither is possible, what is the Syncfusion recommended pattern for secure image serving when GET requests must be authorized? (Possible alternatives I’m considering: cookie-based auth, signed short-lived tokens in the returned URL, or making the Path public — but I’d prefer an official recommended approach.)

If helpful, I can provide a minimal repro repo or network traces showing the GET failing due to missing Authorization header.

 

Thanks for looking into this.

 

Best regards"




VJ Vinitha Jeyakumar Syncfusion Team November 6, 2025 10:23 AM UTC

Hi 


Your requirement can be achieved by using the OnImageUploadSuccess event, where you can get the image file name and URL and modify it. Please refer to the documentation below,



Loader.
Up arrow icon