Skip to content

Firebase Hosting

Firebase Hosting is Google’s web hosting platform for static sites and progressive web apps. When calling external APIs directly from your Firebase-hosted application, you may encounter CORS errors since many APIs only accept requests from server environments.

Corsfix eliminates these errors by providing a secure proxy service that allows your Firebase Hosting application to communicate with any API without CORS restrictions.

1. Deploy Your Application to Firebase Hosting

Section titled “1. Deploy Your Application to Firebase Hosting”

Start by deploying your project to Firebase Hosting using the Firebase CLI or your preferred deployment method. After deployment completes, you can access your live application URL from the Firebase Console under the Hosting tab.

Firebase Hosting Deployment URL Access your live application URL from the Firebase Console Hosting section

Keep this URL handy as you’ll need it for configuring Corsfix in the upcoming step.

Go to the Corsfix application dashboard and register your Firebase Hosting deployment URL as an allowed origin for API requests.

Adding Firebase Hosting Origin Register your Firebase Hosting application URL in the Corsfix dashboard

Once you’ve configured your domain as an allowed origin, your API requests through Corsfix will operate correctly in your deployed application.

With the setup complete, navigate to your live Firebase Hosting application and test your API functionality. Your requests should now route through the Corsfix proxy without encountering any CORS restrictions.

Successful API Request API requests now function properly without CORS errors

Open your browser’s developer tools to verify that CORS errors have been resolved and your API calls are completing as intended.

If you’ve connected a custom domain to your Firebase Hosting project, be sure to add your custom domain (e.g., https://yourdomain.com) to the allowed origins in the Corsfix dashboard instead of the default Firebase-generated URL.