fetch('https://dbpedia.org/resource/Ambrose') request on https url gets redirected to an http address and is blocked by the browser

fetch('https://dbpedia.org/resource/Ambrose', { headers: { 'Accept': 'application/ld+json' }})

Will be blocked in a https context by the browser.
It gets a 303, See other and the location will be http.
I think this might be a bug in the code base of DBpedia.

Kind regards Daniel

Hi @danielbeeke. The URL - ‘https://dbpedia.org/resource/Ambrose’ no longer exists and gets automatically redirected to About: Ambrose and then the fetch functionality works perfectly. So I would suggest you to try out About: Ambrose URL instead.

Thanks for the advise,
I would rather file this as a bug of the DBpedia infrastructure, but I do not know where to do that.

It does a redirect from https to http, that is not allowed in the browser when using https.

A little bit of background: I am creating a form system that uses the /resource/* url to show when a person goes there it is redirected to a human readable page and when I fetch it with a jsonld header, I get jsonld.

So I need these redirects to function properly.

In my opinion, the redirects are working perfectly. Have a look at a sample code and its output. Correct me if I interpreted it incorrectly.


Also, I am not sure about the redirect from https to http that you are talking about as there is no such redirect to http happening on my end. In the code, as you can see, although the URL entered is resource, it fetches from the page URL.

Did you spin up your own server that used https?
It should happen in the context of a valid https website.
You can even do it in this page. You can open up the console and use the javascript from your snippet.

The fetch method follows redirects automatically. So you would not notice untill there is an error.

It might be that the forum does not allow because of CSP
A local dev server should work.

This is true though, I tried it. I believe you are working on a local dev server or something else? If you are working on a local dev server it should work fine.

Hi @sauravjoshi23 Thank you for your replies.

Maybe these screenshots make it more clear.

1 Like

I did not read it entirely but I already filed an issue for this https://github.com/dbpedia/extraction-framework/issues/722

@danielbeeke a “quick&dirty” fix in the meanwhile is to allow mixed content / cross site requests for dbpedia.org

cc @pkleef