Python Flask WkHTMLtoPDF not loading local CSS and files - wkhtmltopdf

I am getting the following error, despite adding the appropriate options
rendered= render_template('data.html', data=data)
options = {'enable-local-file-access' : True}
pdf = pdfkit.from_string(rendered,False,configuration=config,options=options)
From what I read I need to give the file access, hence I defined that options to allow local file access. But it still throws a bunch of weird errors
OSError: wkhtmltopdf reported an error:
Loading pages (1/6)
Error: Failed to load file:///static/css/bootstrap.min.css, with network status code 203 and http status code 0 - Error opening /static/css/bootstrap.min.css: The system cannot find the path specified.
Warning: Failed to load file:///static/css/all.css (ignore)
Warning: Failed to load file:///static/css/base.css (ignore)
Error: Failed to load file:///static/js/jquery-3.2.1.slim.min.js, with network status code 203 and http status code 0 - Error opening /static/js/jquery-3.2.1.slim.min.js: The system cannot find the path specified.
Warning: Failed to load file:///static/js/sweetalert2#11.js (ignore)
Warning: Failed to load file:///static/css/modern.css (ignore)
Error: Failed to load file:///static/js/survey.jquery.min.js, with network status code 203 and http status code 0 - Error opening /static/js/survey.jquery.min.js: The system cannot find the path specified.
Error: Failed to load file:///static/js/jquery-3.6.0.min.js, with network status code 203 and http status code 0 - Error opening /static/js/jquery-3.6.0.min.js: The system cannot find the path specified.
Error: Failed to load file:///static/js/popper.min.js, with network status code 203 and http status code 0 - Error opening /static/js/popper.min.js: The system cannot find the path specified.
Error: Failed to load file:///static/js/bootstrap.min.js, with network status code 203 and http status code 0 - Error opening /static/js/bootstrap.min.js: The system cannot find the path specified.
Warning: Failed to load file:///static/img/logo.png (ignore)
Error: Failed to load http://true/, with network status code 3 and http status code 0 - Host true not found
Error: Failed loading page http://true (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: ContentNotFoundError
192.168.50.219 - - [05/Aug/2021 21:56:12] "GET /responses/2?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
192.168.50.219 - - [05/Aug/2021 21:56:12] "GET /responses/2?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
192.168.50.219 - - [05/Aug/2021 21:56:12] "GET /responses/2?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
192.168.50.219 - - [05/Aug/2021 21:56:12] "GET /responses/2?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -
192.168.50.219 - - [05/Aug/2021 21:56:12] "GET /responses/2?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -

ContentNotFoundError seems to occur when another file that is loaded in the file in error cannot be found.
An example of this is loading font files.
Bootstrap contains a lot of fonts and they cause errors.
I also don't know how to get all fonts to load correctly.
If you simply read the font with CSS, there is a way to convert it to base64

Related

There is no .trace file found for performance profile ‘Leaks’

Following this example and using Javascript, get the following error when run my tests. The error is generated on the following command:
enter code heredriver.executeScript('mobile: stopPerfRecord', [
{ profileName: 'Leaks' },
]);
Error:
Got this error “Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: There is no .trace file found for performance profile ‘Time Profiler’ and device XXXX. Make sure the selected profile is supported on this device”

Guacamole ,Failed to load resource: the server responded with a status of 403 (Forbidden)

I'm facing same problem as 'https://stackoverflow.com/questions/33499048/the-user-mapping-xml-file-doesnt-work-in-guacamole-invalid-login#'
However, it doesn't solve my problem so far.
Mine is guacamole-client-1.0.0 on tomcat 7.0.76 and CentOS 7.8.2003.
I did ln -s /etc/guacamole/ /usr/share/tomcat/.guacamole and restart tomcat
Then,google Chrome shows.
`Failed to load resource: the server responded with a status of 403 (Forbidden) http://10.0.3.13:8080/guacamole-1.0.0/api/tokens`
I need farther information to fix the problem.
This is a message in log.
10.0.20.111 - - [23/Jun/2020:21:15:44 +0900] "GET /guacamole-1.0.0/api/tokens HTTP/1.1" 500 183
As I commented,I made misspelling in user-mapping.xml.
After I fix the error,guacamole goes forward.

Server error 500 on register form submission

I have a laravel application which I have hosted on a Digital Ocean droplet using Laravel Forge. Every time I clicked submit on my registration form it saves the data in the database and displays a server error 500.
I have managed to cd into my nginx error logs using the sudo root access and have been able to come up with this, please help me out
/home/forge/onenaira.com.ng/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(289): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException))
/home/forge/onenaira.com.ng/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(188): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Obje" while reading response header from upstream, client: 105.112.66.215, server: onenaira.com.ng, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "onenaira.com.ng"
2019/05/02 22:22:14 [error] 10655#10655: *1 FastCGI sent in stderr: "PHP message: PHP Warning: include(/home/forge/onenaira.com.ng/vendor/symfony/http-foundation/Request.php): failed to open stream: No such file or directory in /home/forge/onenaira.com.ng/vendor/composer/ClassLoader.php on line 444PHP message: PHP Warning: include(): Failed opening '/home/forge/onenaira.com.ng/vendor/composer/../symfony/http-foundation/Request.php' for inclusion (include_path='.:/usr/share/php') in /home/forge/onenaira.com.ng/vendor/composer/ClassLoader.php on line 444PHP message: PHP Fatal error: Uncaught Error: Class 'Symfony\Component\HttpFoundation\Request' not found in /home/forge/onenaira.com.ng/vendor/laravel/framework/src/Illuminate/Http/Request.php:15
Stack trace:
/home/forge/onenaira.com.ng/vendor/composer/ClassLoader.php(444): include()
/home/forge/onenaira.com.ng/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/home/forge/one...')
[internal function]: Composer\Autoload\ClassLoader->loadClass('Illuminate\Http...')
/home/forge/onenaira.com.ng/public/index.php(55): spl_autoload_call('Illuminate\Http...')
{main}
thrown in /home/forge/onenaira.com.ng/vendor/laravel/framework/src/Illuminate/Http/Request.php on line 15" while reading response header from upstream, client: 105.112.23.124, server: onenaira.com.ng, request: "GET /password/api/slotcount HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "onenaira.com.ng", referrer: "https://onenaira.com.ng/password/reset

How do I stop Spring Boot from printing a stack trace for ; security errors?

How do I stop this exception from being printed in the log file catalina.out? It takes up a lot of room in the log file.
2018-10-12 02:25:20.394 ERROR 20077 --- [nio-8080-exec-7] o.s.boot.web.support.ErrorPageFilter : Forwarding to error page from request [/home] due to exception [The request was rejected because the URL contained a potentially malicious String ";"]
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String ";"
at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlacklistedUrls(StrictHttpFirewall.java:265) ~[spring-security-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:245) ~[spring-security-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
+50 more lines
I don't mind the single line ERROR but I'd rather not see the stack trace while scrolling through the log.
They are caused by testing requests like
172.31.43.154 - - [12/Oct/2018:07:52:42 +0000] "POST /dologin HTTP/1.1" 302 0 "-" "python-requests/2.18.4" "99.99.99.99"
172.31.43.154 - - [12/Oct/2018:07:52:42 +0000] "GET /home;jsessionid=4B9B7C8FFC2EA0B7A8E0C2E20E0B4D79 HTTP/1.1" 200 27 "-" "python-requests/2.18.4" "99.99.99.99"
I don't know if the tester is manually adding the cookie to the URL or being redirected to that path. It works in the browser and I already have
server.session.tracking-modes=cookie

drupal 7 image style error with php max upload size

There is issue while uploading image more 5M with high quality , Image style can not create image or something else (i have no idea what is happening with it) .
2015/08/11 11:43:51 [error] 17642#0: *1513886 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 15360 bytes) in /system/image.gd.inc on line 232" while reading response header from upstream, client: "server ip adress", server: hostname.domain, request: "GET 044a8109_fu_ben_.jpg?itok=u19u-70Y HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web156.sock:", host: "hostname.domain", referrer: "domain/product/379"
In server max upload size : 128M , for image field max upload size is 50M, But not showing uploaded images.
In Chrome browser console so error shows:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
/default/files/styles/thumbnail/public/25531... Failed to load resource: the server responded with a status of 500 (Internal Server Error).
Second image is after creating content .
You have exceded you memory_limit. Check php.ini file for you memory_limit and upadate as necessary.
This may help.

Resources