Pergunta

I'm having a problem submitting an AJAX form (it is a sign-up modal form, that ideally, should be available on all of the pages) from HTTP (unsecured) to HTTPS (secured) part of the site.

The problem is - I'm getting status "200 OK", but no actual response is available (hard to debug actually) and nothing happens after it (but it should).

If I do the same request from one of the secured (HTTPS -> HTTPS) pages - it works totally fine.

Also in the log file I see following message: "WARNING: Can't verify CSRF token authenticity".

I tried skipping this CSRF filter, but no difference.

Can it be fixed somehow, apart from enabling SSL on the entire site ?

Foi útil?

Solução

Fixed the problem myself by applying an after_filter to corresponding controller actions:

def access_control_header
    headers["Access-Control-Allow-Origin"] = "*"
    headers["Access-Control-Request-Method"] = "*"
end

Easy :)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top