Closed Corstiaan84 closed 4 years ago
Interesting. I find that really weird.
Can you debug the endpoint in the proxy you see what the http request payload looks like and paste it here in both the failure case and the success case?
Figured it out. Ran a diff against the two types of requests, comparing each header presence and value. When making the request from within the context of the asp.net core app the "Referer" header got set. In any of the other scenarios, it was empty. After setting it to an empty string it worked.
Hmmm, that shouldn’t break it, though...
@Corstiaan84, I cannot seem to repro this. Can you tell me what was in the Referer
header so that I can try to reproduce?
@Corstiaan84 closing this. Please reopen if you can provide a repro or test PR. 😄
I'm using AspNetCore.Proxy to proxy the call to a static resource to an external service. I do some preprocessing to verify the user and to construct the URL to the external service (which I want to keep hidden from the user).
In my Startup.Configure() I have this:
The weird thing is; this works, but only when calling from Postman, directly from the address bar in the browser, or from a static HTML page. BUT... it returns a 403 every time I make the resource request from within my own app, from like a view or template.
So when I add an img tag to a static local plain HTML page it works:
<img src="https://localhost:5001/attached_resource/104" />
When I put the EXACT same img tag in a .cshtml view or layout, the chrome console (and the asp.net core app terminal) shows returning 403.
Using asp.net core 3.1 with a few server-side rendered Blazor components. So a plain MVC app, not an all-out Blazor app.
I must be missing something very obvious. Any ideas? Thanks for thinking along with me.