PDF content blocked over /proxy/<port>/
See original GitHub issueFirst, let me thank you for a great product. My general workflow involves a lot of drawing and frequent use of latex. An iPad makes a perfect travel companion once it comes with a functional latex IDE. Code-server makes that happen. The only issue is the built-in pdf viewer. (Other pdf viewer extensions can be substituted but do not have built in synctex nor behave as smoothly.) In Latex Workshop extension currently, the pdf viewer listens on localhost:<random port> which is not accessible.
The best VS Code extension for latex is currently Latex Workshop. Unfortunately, the developers there have chosen to not support code-server. As such, one needs to hack in a solution to point their pdf server at code-server.
Of the two methods, available subpaths or subdomains, I chose subpaths. I modified the source to include a code-server flag and url (https://code.example.com
below) in the extension settings. The result defaults to the existing setup if the code-server flag is not enabled. Otherwise, it directs the pdf server to serve the pdf file at https://code.example.com/proxy/<port>/
Here is a complete example URL generated:
https://code.example.com/proxy/41467/viewer.html?file=pdf..JTJGaG9tZSUyRm1hdHRoZXdyb2JlcnRiYWxsYXJkJTJGbGV0dGVycyUyRkFsZXhfRHVuY2FuJTJGZHVuY2FuX2JyZWFrdGhyb3VnaC5wZGY
The behavior in code-server is shown here and if I try to open directly in Firefox I see the toolbox for the pdf viewer but no content. The pdf server is poking through but the pdf itself is not.
My approach is very similar to that of @lukas-hetzenecker taken at #https://github.com/James-Yu/LaTeX-Workshop/pull/2341 except that subdomains are implemented there.
- Web Browser: Chrome
- Local OS: Ubuntu 18.04
- Remote OS: Debian Buster
- Remote Architecture: x86
code-server --version
: 3.7.4
When adding the extension to your code-server install, I have found it loaded incompletely (even with multiple versions of the official release) unless one rigorously follows the following steps:
- Uninstall an existing Latex Workshop extension
- Close any existing browsers
- Reload code-server
- Install from the vsix file from the command line
- Reload code-server
- Browse back to your install.
You can find the modified vsix here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
95% all the issues lie in how the latex-workshop is written (the url for pdf viewer server in particular) so this isn’t a code-server problem. It is only a problem if you want to use the built in pdf viewer with the latex-workshop extension (say because you like the synctex integration and don’t want to write) while using code-server. If you specifically want a working pdf viewer in the latex-workshop extension, you can modify the source code as shown here and compile the vsix yourself. I did this and have been using it without issue for months.
Root viewer.js vs proxy path viewer.js is a problem. It previously could not locate it and other scripts. But, it doesn’t seem to solve the issue. In fact, the behavior seems the same. The tool bar renders but not the pdf inside the main container.