1

I'm trying to setup reverse Proxy auth requests to firebaseapp.com for Firebase as it says in the documentation (https://firebase.google.com/docs/auth/web/redirect-best-practices#proxy-requests). I am hosting my Firebase install and I am trying to use signInWithRedirect. Im trying to follow their documentation but I am a little confused cause it nothing seems to be happening. I'm using Apache. I am trying to setup both Google and Apple Sign In but with signInWithRedirect.

I thought by following the setup I can use the below url but instead I get a 404.

https://example.com/__/auth/handler

Here is how I have it setup

Below are my Authorized redirect URIs in Google Cloud setup:

https://example.com/__/auth/handler

Below I added to my virtual host conf file (Post VirtualHost Include) on my server and restarted apache:

# HTTP Configuration
<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / https://www.example.com
</VirtualHost>

# HTTPS Configuration
<VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /home/example/public_html

    SSLEngine on
    SSLCertificateFile /var/cpanel/ssl/apache_tls/example.com/certificates
    SSLCertificateKeyFile /var/cpanel/ssl/apache_tls/example.com/combined

    ProxyPreserveHost On
    ProxyPass /__/auth/ https://example-b54e1.firebaseapp.com/__/auth/
    ProxyPassReverse /__/auth/ https://example-b54e1.firebaseapp.com/__/auth/

</VirtualHost>

In firebase config I have:

const firebaseConfig = {
  apiKey: "{API_Key}",
  authDomain: "example.com",
  projectId: "example-b54e1",
  storageBucket: "example-b54e1.appspot.com",
  messagingSenderId: "{number}",
  appId: "{number}",
};
kelsheikh
  • 1,278
  • 3
  • 17
  • 37

0 Answers0