Skip to content

Commit

Permalink
fix: not hanging on missing ip (#3295)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Burtey <[email protected]>
  • Loading branch information
nicolasburtey and Nicolas Burtey authored Oct 2, 2023
1 parent a033523 commit 52b5bc9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/api/src/servers/graphql-admin-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ const setGqlAdminContext = async (
const logger = baseLogger
const tokenPayload = req.token

// TODO: delete once migration to Oauth2 is completed
const ipString = UNSECURE_IP_FROM_REQUEST_OBJECT
? req.ip
: req.headers["x-real-ip"] || req.headers["x-forwarded-for"]

const ip = parseIps(ipString)
let ip = parseIps(ipString)
if (!ip) {
logger.error("ip missing")
return
ip = "127.0.0.1" as IpAddress // dummy ip
}
// end TODO

// TODO: loaders probably not needed for the admin panel
const loaders = {
Expand Down

0 comments on commit 52b5bc9

Please sign in to comment.