baseUrl return nothing
See original GitHub issuethe 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:
- Created 7 years ago
- Comments:11 (4 by maintainers)
Top 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 >
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
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.
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, usereq.url
instead.