0

I have some api http://myapi.com.

I added tls 1.3, moved to https://myapi.com

And now my angular client cannot send requests to api http://myapi.com. Errors appears:

Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

I added some config to my .htaccess:

<IfModule mod_headers.c>
    Header always set Access-Control-Allow-Origin "*"
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header always set Access-Control-Max-Age "1000"
    Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
</IfModule>

RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

It works fine for https requests, but dont work for http requests. I cant change url in my angular appilcation, because we have old clients - it is compiled application - and must save backward compatibility

Is is possible disable redirect for http option request?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.