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.

PDF content blocked over /proxy/<port>/

See original GitHub issue

First, 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:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
c0ppeliuscommented, May 6, 2021

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.

1reaction
c0ppeliuscommented, Dec 8, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

coder/code-server - PDF content blocked over /proxy/<port>
Unfortunately, the developers there have chosen to not support code-server. As such, one needs to hack in a solution to point their pdf...
Read more >
Proxy Server and Firewall Issues - PDF Studio Knowledge Base
1. Check User Browser Settings · 2. Check Proxy Server / Firewall Settings · 3. Set Up PDF Studio to Go Through Your...
Read more >
Knowledge: Google Chrome - Content Is Blocked Error Message
You may encounter an error message ("This content is blocked") when attempting to open a PDF in an Open Learning course. This article...
Read more >
Proxy Port - SysML Plugin 18.4 - No Magic Documentation
The direction prefixes of Proxy Ports are displayed: In Block Compartment; In the Model Browser; On the Proxy Port shape ...
Read more >
Change proxy settings on Mac - Apple Support
Configure proxy server settings automatically. Automatic proxy configuration. Use a proxy auto-configuration (PAC) file. Enter the address of the PAC file in ...
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