New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When 'localhost' '127.0.0.1' 'No 'Access-Control-Allow-Origin' header is present on the requested resource' #241
Comments
Because browsers send |
I have tried |
I also tried http://127.0.0.1.xip.io/. |
@Aliemeka and you're loading the page at 127.0.0.1.xip.io ? |
Don't worry, I have fixed the issue. I didn't add a backlash the end of the
URL.
I was trying '127.0.0.1:8000/api' instead of '127.0.0.1.8000/api/'
Thanks anyway
…On Wed, Jan 15, 2020 at 3:54 PM Adam Johnson ***@***.***> wrote:
@Aliemeka <https://github.com/Aliemeka> and you're loading the page at
127.0.0.1.xip.io ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#241?email_source=notifications&email_token=AF33DT7SJXZZ4A4JPN73ABTQ54PR3A5CNFSM4DTD42W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJASOQI#issuecomment-574695233>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF33DT76I47K6VN7HKI3JRDQ54PR3ANCNFSM4DTD42WQ>
.
|
Repository owner
locked as off-topic and limited conversation to collaborators
Jan 15, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I used django-cors-headers, and config it.
Backend:
Django + django-rest-framework
settings.py
python manage.py runserver 0.0.0.0:8000
Frontend:
vue + axios
I try 3 url to access
http://ip:8000/api/xxx
http://127.0.0.1:8000/api/xxx
http://localhost:8000/api/xxx
When request host is ip(192.168.1.xxx):
It worked ok.
When request host is 'localhost' or '127.0.0.1':
It did not work
Question:
Why '127.0.0.1' & 'localhost' can not work well, I added
CORS_ORIGIN_ALLOW_ALL = True
already...The text was updated successfully, but these errors were encountered: