How to set proxy or get base url?
See original GitHub issueI asked on spectrum but got no response so i’m asking here again. i apologize about that.
I want to use Now lambda with Nextjs for my next app but i don’t know how to set the proxy.
In CRA we simply add it to package.json but i don’t know how to do it in Next. I want to be able to dynamically change API_URL to localhost when testing lambdas locally
That’s what i have for now.
infra.config.json
{
"api_url": {
"value": "https://test-nextjs.sarkurd.now.sh/api"
}
}
next.config.js
const withSass = require('@zeit/next-sass')
const API_URL= require("./infra.config.json").api_url.value;
module.exports = withSass({
target: "serverless",
env: {
API_URL
}
});
now.json
{
"version": 2,
"name": "test-nextjs",
"builds": [
{
"src": "next.config.js",
"use": "@now/next"
},
{
"src": "api/*.js",
"use": "@now/node"
}
]
}
I want to be able to dynamically change API_URL to localhost when testing lambdas locally
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How do I set the base URL for my proxied app? - Stack Overflow
It modifies the base url only if a reverse proxy header is set because the modification is only necessary when a reverse proxy...
Read more >Global Settings — GeoServer 2.22.x User Manual
GeoServer can have the capabilities documents report a proxy properly. “The Proxy Base URL” field is the base URL seen beyond a reverse...
Read more >Configuring the Server Base URL | Confluence Data Center ...
Proxies. If you are running behind a proxy, ensure that the proxy name matches the base URL. For example: proxyName="foobar.com" ...
Read more >nginx reverse proxy without base url - Server Fault
I want to configure the nginx so I can entrer an url like 192.168.1.100/myapp and it goes to the other app. The configurations...
Read more >Solved: Apigee proxy base url - Google Cloud Community
https://<OrgName-Environment>.apigee.net/proxy_base_path/. Is there any way to mask the domain name, instead of using apigee.net; can we use our ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh I’m sorry @SarKurd – it seems I misunderstood.
In this regard the proper solution is a build time environment variable that is different on your maching or during dev than it is while deployed. You could use phases to solve this.
two things
now dev(should hopefully be published soon)