question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set proxy or get base url?

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Timercommented, Jun 14, 2019

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.

1reaction
Janpotcommented, May 7, 2019

two things

  1. passing environment variables is currently broken using now dev (should hopefully be published soon)
  2. there’s some example that seems to “automatically” do what you want, but some potential issues with it .
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found