jstefanop / apolloui-v2

Apollo WebOS 2 Front End
Other
0 stars 0 forks source link

HTTPS Proxy Support #7

Open marcelhintermann opened 2 months ago

marcelhintermann commented 2 months ago

Hi Apollo Team,

I've recently got my Apollo miners and i really like the experience and UI. You did a great job there.

I'm currently working on making the Apollo UI accessible via a custom domain over HTTPS. To achieve this, I’ve set up a proxy that handles all the HTTPS traffic and offloads the SSL termination.

However, I am encountering an issue where the UI attempts to make requests to http://mydomain.com:5000 to connect with the GraphQL API. Since these requests are made over HTTP, they are blocked due to the browser’s "strict-origin-when-cross-origin" Referrer Policy, resulting in the following error:

Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure resource '<URL>'. This request has been blocked; the content must be served over HTTPS.

Could you please advice if there is a possible solution to that problem like:

A) Proxying API Requests: Configure the frontend to create an endpoint (e.g /api/) on the same address as the UI, which would forward these requests to the backend GraphQL API.

B) Backend Endpoint Config: Make the backend configurable as a second service under the same domain, thus avoiding mixed content errors entirely.

Thank you for your assistance.

Best regards, Marcel

jstefanop commented 2 months ago

Thoughts @michelem09 ?

michelem09 commented 2 months ago

Well, this is something we didn't think about, indeed in the code we use only http for GraphQL request. Of course something we need to fix. In the meantime you could try to directly change the code here: https://github.com/jstefanop/apolloui-v2/blob/main/src/lib/apolloClient.js#L42