API Gateway POST request returns "error http://localhost:3000 is not allowed by...
up vote
0
down vote
favorite
So I'm trying to write a POST method that triggers a lambda function which will in turn write to a DynamoDB database. The logic behind all of that seems fine, and I can invoke the lambda function when I make a POST request to the API through POSTMAN. However, when I try to do the same from my actual application, which doesn't currently have a domain, I get the error:
Type error: Origin http://localhost:3000 is not allowed by
Access-Control-Allow-Origin
Since I don't have a domain I am developing using localhost:3000. Can I get this to work with API Gateway? I already have CORS setup with [*] as my list of domains, so this should be open to every domain.
amazon-web-services aws-api-gateway
add a comment |
up vote
0
down vote
favorite
So I'm trying to write a POST method that triggers a lambda function which will in turn write to a DynamoDB database. The logic behind all of that seems fine, and I can invoke the lambda function when I make a POST request to the API through POSTMAN. However, when I try to do the same from my actual application, which doesn't currently have a domain, I get the error:
Type error: Origin http://localhost:3000 is not allowed by
Access-Control-Allow-Origin
Since I don't have a domain I am developing using localhost:3000. Can I get this to work with API Gateway? I already have CORS setup with [*] as my list of domains, so this should be open to every domain.
amazon-web-services aws-api-gateway
Have you enabled CORS on your API Gateway Resource? There's a checkbox you can use to enable it easily.
– AlexK
Nov 19 at 8:54
Yes CORS is enabled. I'm wondering if it's an issue with using localhost:3000 as my origin. Like I said it works through Postman
– KSamra
Nov 19 at 22:38
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So I'm trying to write a POST method that triggers a lambda function which will in turn write to a DynamoDB database. The logic behind all of that seems fine, and I can invoke the lambda function when I make a POST request to the API through POSTMAN. However, when I try to do the same from my actual application, which doesn't currently have a domain, I get the error:
Type error: Origin http://localhost:3000 is not allowed by
Access-Control-Allow-Origin
Since I don't have a domain I am developing using localhost:3000. Can I get this to work with API Gateway? I already have CORS setup with [*] as my list of domains, so this should be open to every domain.
amazon-web-services aws-api-gateway
So I'm trying to write a POST method that triggers a lambda function which will in turn write to a DynamoDB database. The logic behind all of that seems fine, and I can invoke the lambda function when I make a POST request to the API through POSTMAN. However, when I try to do the same from my actual application, which doesn't currently have a domain, I get the error:
Type error: Origin http://localhost:3000 is not allowed by
Access-Control-Allow-Origin
Since I don't have a domain I am developing using localhost:3000. Can I get this to work with API Gateway? I already have CORS setup with [*] as my list of domains, so this should be open to every domain.
amazon-web-services aws-api-gateway
amazon-web-services aws-api-gateway
edited Nov 22 at 9:41
Ryan Lee
293
293
asked Nov 19 at 4:31
KSamra
405
405
Have you enabled CORS on your API Gateway Resource? There's a checkbox you can use to enable it easily.
– AlexK
Nov 19 at 8:54
Yes CORS is enabled. I'm wondering if it's an issue with using localhost:3000 as my origin. Like I said it works through Postman
– KSamra
Nov 19 at 22:38
add a comment |
Have you enabled CORS on your API Gateway Resource? There's a checkbox you can use to enable it easily.
– AlexK
Nov 19 at 8:54
Yes CORS is enabled. I'm wondering if it's an issue with using localhost:3000 as my origin. Like I said it works through Postman
– KSamra
Nov 19 at 22:38
Have you enabled CORS on your API Gateway Resource? There's a checkbox you can use to enable it easily.
– AlexK
Nov 19 at 8:54
Have you enabled CORS on your API Gateway Resource? There's a checkbox you can use to enable it easily.
– AlexK
Nov 19 at 8:54
Yes CORS is enabled. I'm wondering if it's an issue with using localhost:3000 as my origin. Like I said it works through Postman
– KSamra
Nov 19 at 22:38
Yes CORS is enabled. I'm wondering if it's an issue with using localhost:3000 as my origin. Like I said it works through Postman
– KSamra
Nov 19 at 22:38
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try to
change localhost to "lvh.me" which points to 127.0.0.1
or
edit your hosts file so that local.[mysite].com points to 127.0.0.1, then make your CORS file allow *.[mysite].com
check:
stack
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try to
change localhost to "lvh.me" which points to 127.0.0.1
or
edit your hosts file so that local.[mysite].com points to 127.0.0.1, then make your CORS file allow *.[mysite].com
check:
stack
add a comment |
up vote
0
down vote
Try to
change localhost to "lvh.me" which points to 127.0.0.1
or
edit your hosts file so that local.[mysite].com points to 127.0.0.1, then make your CORS file allow *.[mysite].com
check:
stack
add a comment |
up vote
0
down vote
up vote
0
down vote
Try to
change localhost to "lvh.me" which points to 127.0.0.1
or
edit your hosts file so that local.[mysite].com points to 127.0.0.1, then make your CORS file allow *.[mysite].com
check:
stack
Try to
change localhost to "lvh.me" which points to 127.0.0.1
or
edit your hosts file so that local.[mysite].com points to 127.0.0.1, then make your CORS file allow *.[mysite].com
check:
stack
answered Nov 20 at 13:41
guzial
6312
6312
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53368347%2fapi-gateway-post-request-returns-error-http-localhost3000-is-not-allowed-by%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you enabled CORS on your API Gateway Resource? There's a checkbox you can use to enable it easily.
– AlexK
Nov 19 at 8:54
Yes CORS is enabled. I'm wondering if it's an issue with using localhost:3000 as my origin. Like I said it works through Postman
– KSamra
Nov 19 at 22:38