Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CORS request across different ports did not succeed on Firefox but works on Chrome

I'm making CORS requests from https://169.254.128.2:8443 to APIs served on https://169.254.128.2:8444 by lighttpd server. Lighttpd has CORS enabled with the following response headers but the OPTIONS request does not go through on Firefox.

setenv.add-response-header = (
    "Access-Control-Allow-Origin" => "*" (tried https://169.254.128.2:8443 too),
    "Access-Control-Allow-Headers" => "accept, origin, x-requested-with, content-type, x-transmission-session-id, x-ida-auth-token, content-disposition",
    "Access-Control-Expose-Headers" => "X-Transmission-Session-Id",
    "Access-Control-Allow-Methods" => "GET, POST, OPTIONS, PUT"
    )

I get the error: MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT. I'd like to know if there is a way to communicate with 8444 other than explicitly accepting the certificate for 8444. I already accept the certificate for 8443 when I first access the url https://169.254.128.2:8443 and 8444 and 8443 use the same certificates. The requests go through fine on both Chrome and Safari without accepting certificates.

like image 663
Varsha Venugopal Avatar asked Aug 13 '18 23:08

Varsha Venugopal


People also ask

Why are my CORS requests failing in Firefox?

ANSWER: While unrelated to the OP's specific case, it may help you to know that Firefox does not trust CA's (certificate authorities) in the Windows Certificate Store by default, and this can result in failing CORS requests in Firefox (as was alluded to by Svish in the question comments).

What does Cors stand for in http?

Cross-Origin Resource Sharing (CORS) Cross-Origin Resource Sharing (CORS) is an HTTP -header based mechanism that allows a server to indicate any other origin s (domain, scheme, or port) than its own from which a browser should permit loading of resources.

What is Cors error in cPanel?

CORS errors Cross-Origin Resource Sharing (CORS) is a standard that allows a server to relax the same-origin policy. This is used to explicitly allow some cross-origin requests while rejecting others. For example, if a site offers an embeddable service, it may be necessary to relax certain restrictions.

Why my CORS is not working?

The problem is that your server does not accept your Cors request: No 'Access-Control-Allow-Origin' header is present on the requested resource. So you have to enable cors on the server side:


1 Answers

This is a Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=700837

You must enable the certificate on each port individually.

Open the url in Firefox and accept the certificates for https://169.254.128.2:8443 and https://169.254.128.2:8444

like image 78
Carlos Queiroz Avatar answered Sep 22 '22 23:09

Carlos Queiroz