score:1
Accepted answer
thank you for the hint @david, @beppe and @yusuf. in my case i just change the api endpoint to the app address it self.
example if the app run on
localhost:3001
then i set the api endpoint to be
localhost:3001/api
in the nginx config i add another location in the server block with re-write condition
upstream api {
server api:5000;
}
server {
listen 80;
location / {
root /usr/share/nginx/html;
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api
}
}
Source: stackoverflow.com
Related Query
- How to configure Nginx reverse proxy properly?
- How to configure Nginx with React Router HistoryLocation?
- How do I configure my Nginx server to work with a React app in a subfolder?
- Use NGinx reverse proxy for create-react-app
- Use NGinx reverse proxy for create-react-app
- How to properly configure Next.js as a frontend and Express app as a backend?
- Nginx reverse proxy and multiple React apps
- How to properly configure .png images in webpack?
- In VSCode how to properly configure jsconfig.json in order for absolute paths with index.js imports to work?
- How to have Nginx to proxy pass only on "/" location and serve index.html on the rest
- create-react-app code changes behind nginx reverse proxy not reloading in browser
- How to Properly Configure Apache on a SPA React App that Resides on a Subdirectory that uses Nested URLs built from React Router?
- Nginx reverse proxy multiple react apps
- How to properly configure Suspense position into Canvas?
- How to configure NGINX to serve a JSON API and a React.js on the same box
- nginx reverse proxy cookie forwarding
- Cannot GET etc with Nginx Reverse Proxy React + Node + PM2
- How do you properly configure gatsby-source-prismic-graphql preview functionality?
- WebSocket connection to "wss" sockjs-node failed for CRA and nginx reverse proxy
- How to configure NGINX to reroute a React Router app built on sub domains?
- serve react create app and Nodejs app with reverse proxy Nginx
- react, nginx reverse proxy and docker giving 404
- React not starting with node.js behind Nginx Reverse Proxy
- How would I configure my webpack.config.js file to properly navigate to other html pages?
- How to ngnix reverse proxy to react application locally?
- How to configure nginx request routing
- How do i properly configure a nested router (react-router-dom)
- NGINX Reverse Proxy with multiple locations for multiple containers
- How can I get my React App to correctly send page title in link previews? Using NGINX as proxy
- Nginx reverse proxy problem on an specified location
More Query from same tag
- How can I make this work with less code and more efficiently? - Mapping Json and rendering components conditionally
- How do I push and object into a state that is an array?
- How to update in correct mode array using Promise function in React.useState?
- React: create closure that's referntially equal across renders with useCallback
- How to toggle setInterval in a child via state that was passed from parent component as a prop
- Modifying React style object seems to corrupt dom styles
- Changing parent state after updating childs prop component in React?
- (React) Dynamic dropdown box examples. HowTo?
- Simple react component fails to read state
- How to solve this error: 'Firebase' is not defined
- how to concatenate styles
- React hooks useState submit on second time from child component
- Where to place 'this.setState in this case?
- React onClick not firing on first click, second click behaves as expected (simple debug message doesn't appear until second click)
- Reactjs every time refreshing page on setState
- No unused expressions on function inside componentDidMount
- ReactJS and Promise: How to call catch inside then?
- Date string to date object
- Change bearer token when axios.create
- Detecting Firebase user change with useEffect vs onAuthStateChanged - what's the difference?
- How to Test useEffect Fetch with Jest in React
- How to apply a half circle mask to an image and add a button inside an image in ReactJS using ant design?
- Spacing and size of horizontal bars in a Victory stack?
- Webpack 4 code splitting not working with React.lazy
- How do I make an ASync function wait, till all the information is gathered?
- Javascript Modify First Word
- Mongoose findOneAndUpdate don´t update and don´t throw an error
- Unexpected token < error in react router component
- How to add id attribute on span tag in WP Block Editor Toolbar Button
- How to solve a problem with Array.sort Cannot assign to read only property '0' of object