N
N
Nikita Filatov2016-11-15 12:48:04
Apache HTTP Server
Nikita Filatov, 2016-11-15 12:48:04

How to set up CORS in apache?

.htaccess config

Header set Access-Control-Allow-Origin "*"

RewriteEngine On  
  # If an existing asset or directory is requested go to it as it is
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
  RewriteRule ^ - [L]

  # If the requested resource doesn't exist, use index.html
  RewriteRule ^ /index.html

when adding a header to allow CORS, the server starts giving a 500 error.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question