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.

baseUrl return nothing

See original GitHub issue

the request url is /validations/2?username=sdfsf&c=3 it is expected that req.baseUrl will be /validations/2, but got nothing.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
dougwilsoncommented, Nov 11, 2016

In your example, undefined for req.baseUrl is how it is supposed to work. Perhaps the documentation is just not clear on how that property works.

What you are expecting is not provided by Express currently, but you are welcome to make a PR to add a feature to do that 😃

Closing since this is working as designed.

1reaction
chill117commented, Apr 19, 2021

The documentation is still confusing regarding req.baseUrl. I had the same misunderstanding as the creator of this issue. For anyone who finds this in the future, use req.url instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

req.baseUrl is empty - node.js - Stack Overflow
I'm building an Express API, the API endpoint is GET /tasks/:id . I need to use req.baseUrl . It should contain '/tasks' in...
Read more >
Site.getBaseUrl returns empty string in test method
getBaseUrl() from test method I get an empty string. ... getBaseUrl() Returns the base URL of the current site that references and links ......
Read more >
Application Properties Returns Null Base URL - Jira Server
We have a single customer where applicationProperties.getString(APKeys.JIRA_BASEURL) Returns null, this is on Jira 8.13.4.
Read more >
Yii::app()->baseUrl returns nothing - General Discussion
hi i have been using Yii::app()->baseUrl to check for url comparisons inside my main.php in the theme folder. the thing is, ...
Read more >
valid non-empty URL potentially surrounded by spaces - HTML
If document 's URL is about:blank , and document 's browsing context's creator base URL is non-null, then return that creator base URL....
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