2

I have created an app in React with its backend in Python Django. I hosted the React app in Heroku and the Django app in AWS (apache2). I have faced a problem with CORS.

I added the following configurations settings in my apache2 config file:

<IfModule mod_headers.c>
    SetEnvIf Origin (.*) AccessControlAllowOrigin=$0
    # SetEnvIfNoCase Origin "https?://(www\.)?(floating-reef-53592\.herokuapp\.com|graph\.facebook\.com|ferosetest\.tk)(:\d+)?$" AccessControlAllowOrigin=$0
    Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
    Header set Access-Control-Allow-Credentials true
    Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
    Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
</IfModule>

Now I can access my React app, but it restricts graph.facebook.com, which I have requested from the Django app. How can I resolve this?

TRiG
  • 1,167
  • 2
  • 13
  • 30
Ferose
  • 131
  • 3

0 Answers0