Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider using relative url for href to work behind a proxy #233

Closed
panlina opened this issue Sep 5, 2018 · 8 comments
Closed

consider using relative url for href to work behind a proxy #233

panlina opened this issue Sep 5, 2018 · 8 comments

Comments

@panlina
Copy link

panlina commented Sep 5, 2018

Hi,
I'm using ecstatic behind a proxy, something like proxying http://localhost/a to http://localhost:8080, where 8080 is the port ecstatic is listening to. The problem is that ecstatic uses absolute url for href, which resolves to a url where the file path is directly appended to the host part, instead of the current url.
For instance, when browsing from http://localhost/a, clicking folder f navigates to http://localhost/f/, instead of http://localhost/a/f/.
I noticed that there's a baseDir option, but it's irrelevant here since the base url(/a) is already eaten by the proxy before baseDir applies.
Using relative url for href may be a solution, but I'm not sure whether you are using absolute path for some reason. How do you think?

@wll8
Copy link

wll8 commented Apr 17, 2019

@panlina Hello, how do you deal with this problem?

@panlina
Copy link
Author

panlina commented Apr 17, 2019

It can not be solved unless you modify the code. You may ask the author to take this into account.

@jfhbrook
Copy link
Owner

jfhbrook commented Apr 17, 2019

panlina made a pull request that tries to address this but removes functionality that I'm not immediately prepared to ditch: #237

If you can propose a concrete change that does what you need without removing the baseDir option, I'm all for it.

@wll8
Copy link

wll8 commented Apr 18, 2019

show-dir/index.js#L98:
You can switch these two lines of code by option.

// let href = `${parsed.pathname.replace(/\/$/, '')}/${encodeURIComponent(file[0])}`;
let href = `${encodeURIComponent(file[0])}`;

The problem between absolute path and relative path can be solved.

@jfhbrook
Copy link
Owner

Oh! If that's all that's needed I'll gladly change that behavior, I just need the time to manually QA it

@panlina
Copy link
Author

panlina commented Apr 18, 2019

Yes, that's all that is needed, but I think an option is not needed, just change it to be relative path.

@wll8
Copy link

wll8 commented Apr 18, 2019

Options are used to ensure that they do not conflict with the author's previous ideas.

@panlina
Copy link
Author

panlina commented Apr 19, 2019

Understood. That's what I'm asking at the end of my post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants