Making recaptcha work with a reverse proxy

recaptcha, reverse-proxy

Solution

For anyone still wondering, I ended up using a lighter-weight captcha solution that did not require additional calls.

Problem

I am trying to include a recaptcha verification on a 'forgot password' screen for users that are trying to connect to a mobile hotspot. Prior to logging in, they have very limited access through the firewall, and therefore the forgot password screen can't download the js file from the standard script generated by Recaptcha.createRecaptchaHtml: ``` <script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k=...."></script> ``` I can get around this by changing the src above to point to a local address, and setting up a reverse proxy to forward it to google. However, this call downloads an additional javascript (https://www.google.com/recaptcha/api/js/recaptcha.js) file that contains more references to google (and I believe other sites as well) that the page cannot reach. Question: Has anyone tried to do something like this, and is there an elegant solution? If not, I will resort to a simpler captcha solution that requires fewer firewall changes.

Original source