Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
How to toggle proxy url in package.json based on the ixp flag? React App

#How to toggle proxy url in package.json based on the ixp flag? React App...#

I would like - the switching of proxy url based on different value of some-variable inside the service class:

I have two proxy servers: - "https://tst.api1.com" and "https://tst.api2.com"

inside React component i have getSex() function that returns either male or female, if male - i would like to invoke api1 else api2;

package.json:

{
"proxy": {
    "/abc": {
        "target": "https://tst.api1.com" // i need this to be toggeled based on getSex() value
    }
  }
}

React Component:

export async function getAllUsers() {
const response = await fetch('/abc/users');
return await response.json();
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!