Runtime API Request to 3rd party DB service is being sent as 'Same Origin' on Static Web App

Nitin Bhamvani 0 Reputation points
2023-03-27T09:08:41.33+00:00

To illustrate the problem, please see the differences in request headers been app running on localhost and on Azure Static Web App service.

On Localhost:

enter image description here

On Azure Static Web Apps Service:

enter image description here

Other Info

The environment variables locally is held in '.env' while on Azure these were on GitHub secrets and referenced under the 'env:' section of the Actions workflow file. There is another API that is referenced in the same way and that works fine, but the working API is called at build time, while the problematic API is called on runtime I suspect.

So, to see if it will resolve this, for the runtime environment variables, I now specify these under Application Settings.
This still has not resolved the issue

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
935 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Nitin Bhamvani 0 Reputation points
    2023-03-28T16:08:35.5966667+00:00

    This was resolved by appending 'GATSBY_' to the front of the environment variables to ensure that it's exposed to the browser.

    0 comments No comments

  2. Ali Sufyan Butt 86 Reputation points MVP
    2023-04-13T12:21:35.3533333+00:00

    Hi, Have you tried to manually amending the environment variables. Sometimes, the settings needs to be explicitly defined

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.