308 error code only on my computer - replit works for others just fine

Question:
I’ve created a superhero villain app, where one can add and remove supervillains. Whenever I try to add or remove a supervillain, I get a 308 error code, however, when other people have run this Replit on their own machine, they are able to add and remove superhero villains without issue. The issue first started in Firefox, but also happens in Chrome in an incognito browser. I’ve tried clearing the cache, removing the local storage, removing the database from the Repl logging out of Replit and logging back in, and re-forking the Repl two times. I don’t understand why it does not work for me, but works for other without issue. Am I missing something?

Repl link/Link to where the bug appears:
https://replit.com/@nicolelaine/201-L9-Step-4-starter-design-api-endpoints-second-try

308 is a permanent redirect code, are you sending API calls to a repl.co URL? If so, that’s your issue, those no longer exist.

2 Likes

Hi there, I don’t think so, but how would I know? If I have, it was not on purpose. Is this something that would only re-direct for one machine and not another? I seem to be the only one having an issue with this code, other people can run the Repl no problem.

It might be per-person, yes. Some accounts are getting malformed dev links that have repl.co at the end instead of replit.dev.

2 Likes

Oh, interesting! When I open it in a new tab, it seems to have replit.dev at the end: https://8d2ffe4d-6021-4644-a00c-a93ac2d6152f-00-3iyzjhx2ck4xg.worf.replit.dev/

That would mean that the API is going to the correct place, right? Or should I be looking elsewhere?

Yes, your link should be working.

Are you using an XML HTTP request?


If so, instead request it over HTTPS.

Yes, correct, the link is working, but I still can’t add or remove a villain card from it. Hm.

I don’t think so? I would know if I was, is that correct? How do I check something like this?

In the file static/addvillain.js, change line 13 to:

$.post(window.location.host+"/api/villains/add", {

This will make it serve over HTTPS.

Interestingly, it leads to a 404 error. Let me see if I can upload a screenshot here:

I’m almost wondering if I should simply create a new Repl and just copy everything in and see if that works. That said, I’ve checked another Repl of mine, I’m also getting errors I was not getting before there as well. I’m a bit of a new Replit user, maybe it’s just that my system and Replit just don’t work together so well anymore. I’m truly baffled.

My bad, try this code:

$.post("https://"+window.location.host+"/api/villains/add", {

No luck, it’s still error 308.

1 Like