Skip to content

Commit

Permalink
add cors header for Desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Nov 5, 2023
1 parent d9cfc8a commit b528ae1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import assert from 'node:assert'
import Sentry from '@sentry/node'

const handler = async (req, res, apiKey, fetch) => {
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3000')

This comment has been minimized.

Copy link
@bajtos

bajtos Nov 6, 2023

Member

This isn't going to work after we deploy the code to Fly.io, right? We need CORS to allow the Desktop to call the service at the domain name where it's deployed.

I am proposing to introduce a new ENV var to control this domain, initialise it to localhost:3000 by default, and then modify the Dockerfile to set this env var to the hostname where we are deploying to.

This comment has been minimized.

Copy link
@juliangruber

juliangruber Nov 6, 2023

Author Member

The origin is the electron app, which always has this address. It's not supposed to be the address of the deployed service

This comment has been minimized.

Copy link
@bajtos

bajtos Nov 6, 2023

Member

🤦🏻

Thank you for explaining!

This comment has been minimized.

Copy link
@bajtos

bajtos Nov 6, 2023

Member

Opened #4

const address = req.url.split('/')[1].trim()
const fetchRes = await fetch(
`https://public.chainalysis.com/api/v1/address/${address}`,
Expand Down

0 comments on commit b528ae1

Please sign in to comment.