Open njseeber1 opened 4 years ago
TBH, I don’t remember setting up any docker stuff. I remember tinkering with docker like 4 years ago, but my familiarity with docker probably rounds to 0. I should probably just remove anything referencing docker in the code.
On Wed, May 6, 2020 at 6:11 PM Nick Seeber notifications@github.com wrote:
Hey, when spinning up the docker container you have in the code I always get a 400 Bad Request error when making an API request that is in the documentation. Any idea on what might be going on there?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/crobertsbmw/deckofcards/issues/81, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMQLHT3BVXQF2VGSCJYKNLRQH4EVANCNFSM4M24D5VA .
Gotcha, thanks for the update! I Appreciate it!
TBH, I don’t remember setting up any docker stuff. I remember tinkering with docker like 4 years ago, but my familiarity with docker probably rounds to 0. I should probably just remove anything referencing docker in the code. … On Wed, May 6, 2020 at 6:11 PM Nick Seeber @.***> wrote: Hey, when spinning up the docker container you have in the code I always get a 400 Bad Request error when making an API request that is in the documentation. Any idea on what might be going on there? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#81>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMQLHT3BVXQF2VGSCJYKNLRQH4EVANCNFSM4M24D5VA .
Hello
There is nothing wrong with the dockerfile.
I'ts just the CORS policy thats blocking your requests.
You need to edit spades/settings.py file and insert your host to ALLOWED_HOSTS ALLOWED_HOSTS = ['.deckofcardsapi.com', '127.0.0.1', 'yourhosthere']
Best regards Jørgen S.
I know this is super old, but I dug into this a little bit today. I couldn't find an error with CORS, but I was able to find a CSRF error when trying to do post requests. I removed the CSRF validation, and now you should be able to make cross site requests. Let me know if that's not he case.
I know this is super old, but I dug into this a little bit today. I couldn't find an error with CORS, but I was able to find a CSRF error when trying to do post requests. I removed the CSRF validation, and now you should be able to make cross site requests. Let me know if that's not he case.
Thank you :) For me adding my hostname/domain to the allowed_hosts fixed the 400 error.
I cant say if thats the same issue that the thread starter was experiencing. But normally docker acts the same for all parties.
I would assume that you could reproduce the error by just spinning up a docker container on another host and then try to access it.
I was wrong to say its the cors policy. Seems like django now requires the hosting domain to be in the list. https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-ALLOWED_HOSTS
Best regards Jørgen S.
Hey, when spinning up the docker container you have in the code I always get a 400 Bad Request error when making an API request that is in the documentation. Any idea on what might be going on there?