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.

Doesn't work with applications which use absolute URLs

See original GitHub issue

I’ve noticed that a few applications that I’ve tried to proxy recently use absolute urls.

For example when running on a regular server if you go to http://localhost:1234/ it will look for a stylesheet at/style/index.css. This works fine when running locally but when using nbserverproxy I visit http://localhost:8888/lab/proxy/1234 which still looks for styles at /style/index.css rather than /lab/proxy/1234/style/index.css.

These applications often take a baseurl config option somewhere which lets you prepend all urls with a base path, such as /lab/proxy/1234. This would allow me to fix this functionality. However it appears nbserverproxy rewrites its urls so when I visit http://localhost:8888/lab/proxy/1234 the path gets rewritten to /. This then causes problems because the application is now expecting a base url of /lab/proxy/1234/. This results in the HTML page not displaying because flask or whatever doesn’t have a route for /, but the CSS would display ok if it were ever requested.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jacobtomlinsoncommented, Jul 24, 2018

That sounds like a pragmatic fix. Perhaps something like proxy_abs for absolute urls?

2reactions
betatimcommented, Jul 23, 2018

We could add an option to (not) rewrite URLs to the proxy? http://localhost:8888/lab/dont_rewrite_me_proxy/1234/ (maybe a slightly shorter URL 😉 )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next.js - Error: only absolute urls are supported
I'm assuming it has something to do with the different environments (client & server) on which your code can be executed. Relative URLs...
Read more >
Why you should (almost) never use an absolute path to ...
There are two solutions to fix this small problem: hardcode absolute API URLs on the client and configure CORS headers on the server;...
Read more >
Absolute vs Relative URLs: when to use which for SEO?
There are two main URL options to use on your website: absolute URLs and relative URLs. Both serve different purposes, so it's important...
Read more >
Avoiding problems with relative and absolute URLs in ASP.NET
I'm back to ASP.NET development, and the first thing that hits me in the face is the limitations with URL handling in ASP.NET....
Read more >
URL() - Web APIs - MDN Web Docs - Mozilla
url (in the case of absolute URLs) or base + url (in the case of relative URLs) is not a valid URL. Examples....
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