AWS setup resulting in CORS error with Elastic Beanstalk


I am working on my thesis about news recommendations and have been working on getting my web application running on AWS. My angular front-end runs on S3 with static hosting, my NodeJS back-end runs on Elastic Beanstalk along with my Flask API. The issue that I’m running into is that when I make a request from Node to Flask or even itself, I get a CROS Missing Allow Origin. I have therefore attempted to add these CORS headers, starting with access-control-allow-origin: * with GET, PUT, PATCH, PUT, DELETE, OPTIONS as methods. I have done this for both NodeJS as well as Flask, but the error remains unchanged. The site itself is available through with NodeJS being on the subdomain and Flask being on (feel free to ‘login’ with any non-sensical username). Accessing the URLs directly does work, for example with and and it also works fine on localhost.

These images show a request that is made when opening an article, to add it to the user history. These images are from the same request.

enter image description here

enter image description here

NodeJS uses


app.use((req, res, next) => {
    "Origin, X-Requested-With, Content-Type, Accept"


and Flask uses

import nltk
import numpy as np
from flask import Flask, request
from flask_restful import Api, Resource
from flask_cors import CORS, cross_origin
from nltk.sentiment import SentimentIntensityAnalyzer
from nltk.tokenize import word_tokenize
from sentence_transformers import SentenceTransformer

application = Flask(__name__)
api = Api(application)

I would like to understand what exactly is causing this and how I could fix it. Thank you for your help


After further debugging, it became clear that it was not actually a CORS error, but instead a server timeout. This was caused by an error that occurred when connecting to the database and was not picked up by the debugging code as part of the connection details that were supposed to be printed were in fact not properly configured on the server causing both the DB connection to fail as well as the debugging code that was supposed to log such a problem. Luckily it only took a week and a half to locate the problem 🙁

Answered By – René Steeman

Answer Checked By – Mildred Charles (AngularFixing Admin)

Leave a Reply

Your email address will not be published.