WebDev error log?

I'm working remotely on an Ignition installation and using WebDev to retrieve some PDFs in an iFrame. The system is running on a Windows server and I don't have access to the OS.

I've got WebDev and the iFrame working on my laptop (Designer and gateway both on the same machine). PDFs appear in the iFrame.

I'm running into 404 errors on the remote machine. I suspect that it may be a Windows permissions problem but I'd like to be sure.

  1. Does WebDev have any error logs? I can't find anything in the gateway | Status | Logs.

  2. If Perspective can read the folder and list the files (indicating that it has permissions) should WebDev be able to deliver files from that same folder?

Thanks!

  1. No Not much, do your own error handling and logging.

  2. I would think so.

Not necessarily, it might be read only for the service account the gateway is running under.

Especially if it is running in the folders that Ignition is installed inside of, Program Files is a protected system folder.

WebDev does send errors to the gateway logs though, I am not sure what all it sends though.

We do see script errors in our logs for webdev.

But there's no scripting involved. As shown in Web Dev | Ignition User Manual, I'm just providing a URL.

Pseudocode - URL to Mounted Folder
http://host:port/system/webdev/projectname/assets/a.jpg

If I type the URL into the browser address bar I get the 404. (On my development laptop it works fine.) On something like an Apache web server I could examine the logs to see what the problem is.

Ah, no idea. Poke at logger debug levels, perhaps. (I will admit to not using mounted folders--I don't trust publishing anything that gets tossed in a folder.)

Mounted folders have next to no error handling, because there's next to no code in them. We should probably have some debug or trace logging to at least indicate what's being attempted, but a 404 from a mounted folder is pretty basic:

    @Override
    public void doGet(PathParser path, HttpServletRequest req, HttpServletResponse resp) throws IOException {

        // Strip the leading resourcePath from the requested path to ensure that resources within folders are resolved.
        String urlPath = StringUtils.replaceOnce(path.getResource(), resourcePath, "");

        // Let Path sort out file separators for us. added bonus of toFile()
        File f = Path.of(this.filePath, urlPath).toFile();
        if (f.isFile() && f.canRead()) {
            String contentType = Files.probeContentType(f.toPath());
            if (urlPath.endsWith(".js") && contentType == null) {
                contentType = "text/javascript";
            }
            resp.setContentType(contentType);
            resp.setContentLength((int) f.length());
            FileUtils.copyFile(f, resp.getOutputStream());
        } else {
            resp.sendError(404);
        }
    }
1 Like

Thanks for the peek under the hood, Paul.

1 Like

I found [Question] PDF Viewer File Path - #6 by osolorzano useful in testing. I think my trouble was a missing _ difference in the WebDev mounted folder configuration and the actual file path.

Thanks all.

1 Like