KLTR
KLTR

Reputation: 1344

forbidden 403 on image URLS

I'm developing a web app using Angular5. I have a database that has some "posts" and each post contains an image URL that I take from 4chan API. The URL is legit (If I check it manually it works) but I get 403 forbidden in my console when I debug in the web browser. another weird thing, if I go to the URL manually and then refresh my app, the image is suddenly shown.

example URL : "http://i.4cdn.org/lgbt/1521711096067.jpg"

Upvotes: 3

Views: 4509

Answers (1)

Ian Berry
Ian Berry

Reputation: 186

Looks like when the HTTP request header referrer is anything other than http://4chan.org, I get this issue. Ive simply added the below to the HTML page and its fixed the problem:

<meta name="referrer" content="no-referrer"/>

Once your Angular app is loaded, you can also use Firefox Developer Console (Network Tab) modify image request (ie 403) and remove referrer header to test.

Remove http referer

Upvotes: 17

Related Questions