napcs/node-livereload

Possible to specify a different path prefix?

Opened this issue · 2 comments

What version of Livereload are you using?

0.9.3

What OS are you using?

Linux

What web browser are you using? (Browser name and specific version please)

Chrome

Expected result

I'd like to specify a non-root path, say "localhost:3002/{path}/livereload.js

Actual result

It doesn't look like this is possible, I believe the route checks strictly for {host}:{port}/livereload.js
I'm using rollup-plugin-livereload to inject the request for the livereload plugin in (live and remote) dev environments, but can't easily serve a secondary port while stripping a path prefix, without using a more advanced load balancer. Specifying a path would solve this, but i'm not certain if it's possible. The source looks like it strictly requires livereload.js to be served from the host root path.

Thanks in advance for help!

Steps to reproduce issue

Why is this important?

napcs commented

@krumware This actually wouldn't be terribly difficult to add, but I don't know if it's worth adding the options, docs, etc given the specificity of the use case. Can you give me an idea of how common this would be and more detail on why someone would want to do this? I think I understand but I'd like a clearer picture.

I'm doing this from memory, so apologies if this is off base:

I think the most common example may be if I deploy multiple front ends at different paths on the same port.

I may have app1 app2 and apple, which each have separate live reload instances. But they each are accessible via path prefix, so mysite/app1, mysite/app2, and mysite/app3.

When deploying to a live environment, I cant open any port I choose, so I can't use separate ports for each frontend in addition to each live reload server. I need to use paths to direct traffic in this instances.

What I can do, is have my load balancer direct certain paths to certain internal ports. Such as mysite:80/app1/livereload.js -> internalservice:3002/livereload.js, but I had trouble, I believe, with request header matching and the way it seems to function with the path match with the port and served at root. So the socket and script are not accessible. Does that make sense?

Thanks for the help!