Open skwde opened 4 months ago
it tries to open the URL http://127.0.0.1:
/ while the preview
127.0.0.1 is supposed to be equivalent to localhost. What does the url get you too exactly ? What is the wrong preview showing exactly ?
I believe we use localhost
for preview URL only , but the host really binds to 127.0.0.1
I found this discussion with history on this : https://github.com/quarto-dev/quarto-cli/pull/947
The preview just gives a 404 error.
Can you reproduce the error?
I think the problem is not with 127.0.0.1
/ localhost
but the missing document name (test.html
).
Compare
http://127.0.0.1:<port>/
(tried by preview, giving 404)with
http://localhost:<port>/test.html
(shown by quarto preview
working when copying.)Note that in the quarto preview
version we have the test.html
which is missing in the url used by the preview.
When I append test.html
to the url used in the preview (http://127.0.0.1:<port>/
) it renders properly.
I think the problem is not with 127.0.0.1 / localhost but the missing document name (test.html).
Oh thanks for making this clearer - I missed this. Definitely something wrong here...
Though I can't reproduce right now
This is with Quarto: preview
menu command.
Same result with quarto preview test.qmd
in VSCODE terminal, though it opened in eternal browser.
In VSCODE we do special handling where the url does not show test.html
but this si the file shown. So somehow this processing may not work for you.
Can you be sure to use latest version to tools ?
Does quarto preview test.qmd
works for you outside of VSCODE in a standalone terminal ? Thanks
I confirm that the VSCode command Quarto: Preview
works.
Here are the related versions
Since I am using a devcontainer it is not working outside VSCode.
Note also, that when _quarto.yml
is not present quarto preview
shows the same URL as used by VSCode when opening via the dialog
So it seems to be a project specific problem with this dialog.
@cderv
I just noticed an additional wrong behavior.
The --port
option seems to be ignored when serving.
When I run
quarto preview test.qmd --port 8010
I get the following output in VSCode
and everything looks fine. But when I now click on "Preview in Editor" the following is opened
The page is only accessible when I use http://localhost:58637/test.html
.
If you click Open in Browser, or look at http://localhost:8010/test.html
inside a browser does it works ?
@cdrev just realized that there was a response.
No, it doesn't matter wheter "Open in Borwser" or "Preview in Editor" is used.
look at http://localhost:8010/test.html inside a browser does it works ?
So nothing shows on 8010 port in browser ? (Outside of VSCODE)
I tested it again. So running
quarto preview test.qmd --port 8010
shows
When I click "Open in Browser" a tab opens at http://localhost:8011/
which just shows Not Found
.
If I connect to http://localhost:8011/test.html
it works even though Is specified port 8010
?!.
When I do the same but click "Preview in Editor" I get the same behavior.
Weirdly, VSCode also shows
Interesting that it says localhost:8011
when you set 8010
🤔
Can you confirm that `quarto preview test.qmd --port 8010``work outside of VSCODE ?
This is to confirm this is Quarto CLI directly, or VSOCDE integration. Thanks.
@cderv outside of VSCode (on MacOS) it just works.
Bug description
When
_quarto.yml
is present (even if empty) a wrong preview url is used even though the correct one is displayed after runningquarto preview test.qmd
. (I use the VSCode extension)Possibly related: https://github.com/quarto-dev/quarto-cli/issues/6409
Steps to reproduce
Create an empty
_quarto.yml
and atest.qmd
likeand run
quarto preview test.qmd
.When choosing either preview option (Editor / Browser) it tries to open the URL
http://127.0.0.1:<port>/
while the preview command actually showshttp://localhost:<port>/test.html
as the correct URL.Expected behavior
Use correct URL to preview
Actual behavior
Wrong URL is used to preview
Your environment
Quarto check output