So, I have both a website and an API configured locally in Docker, that way I can test the site locally and the API too. But the thing is, I have a piece of code in my local machine (not Docker) that I’m trying to use to make some calls to the local API in Docker.
My issue is, when I run my code with vscode, the API requests keep failing and throwing the error: 401 unauthorized. After debugging the request and comparing to the one made in the working site, I find that the only difference between requests is that the origin in the working page it’s the domain itself, while the origin in my local code is my locahost.
I believe this it what is causing the request to fail (could be that the API creators don’t allow CORS), so I’m trying to make it so my local code has the same origin as my docker systems.
Do you guys have any idea on how I could do it?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.