I am using apache2 as a reverse proxy for my parse-server. In order to allow Cross Origin Requests I originally tried setting:
Header always set Access-Control-Allow-Origin "*"
in the apache config file together with:
ProxyPass /parse/ http://localhost:1337/parse/
ProxyPassReverse /parse/ http://localhost:1337/parse/
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
After setting this, the requests were successfully forwarded from apache to my parse-server. However now my Webapp throws CORS Multiple Origin Not Allowed
.
In the developer console of my browser I can see that this Access-Control-Allow-Origin option is set twice.
I have confirmed that the second instance of this appears due to parse-server. However I can not find a way to either prevent parse-server or apache from setting this option in the response.
I tried changing my initial line in the apache config to:
1.
Header always setifempty Access-Control-Allow-Origin "*"
-
Header always add Access-Control-Allow-Origin "*"
-
Header always add Access-Control-Allow-Origin "*"
Header always edit Access-Control-Allow-Origin "^$" "*"
None of these tries changed anything. However removing the Access-Control-Allow-Origin
option in the apache config prevents the initial request from getting through to parse-server, so this is not an option.
I am using apache2 version 2.4.29
and parse-server 4.10.3
.
Does anyone know a way to get this to work?