Caddy webserver Brotli example - caddy

I was trying to deploy my angular2 app with brotli compressed distribution to Caddy webserver.
Are there any examples for the caddy webserver with Brotli compression support?

Caddy currently only serves pre-compressed Brotli files.
So first make sure you have an installation of Google's Brotli tool.
Then generate Brotli-compressed copies of your files with
/path/to/bro --input example.html --output example.html.br
Please note: Make sure to not delete the original.
Caddy will automatically serve the Brotli version where available and the raw version otherwise, it would also be helpful to do the same with pre-compressed gzip, though Caddy can also gzip-compress on the fly.

Related

Brotli not being served with AWS amplify but gzip files are

I'm using Aws amplify to host a vue3 app, I have got webpack bulding the .gz & .br files, have updated my redirect in aws amplify to </^[^.]+$|.(?!(gz|br|css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json)$)([^.]+$)/>
so as gz and br are included. So gzip file are now being served but its not serving brotli files, the amplify cloudfront is setup to enable both gzip and brotli, so i'm stumped as to whats wrong, would anyone know why?

How to serve static files with nginx after using npm run build with webpack

after generating a development build with npm run build i get the message saying
"Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won't work."
What is the best way to do this with nginx? Currently to test it i am using an npm module called serve.
Also, if i got to my homepage at mydomain.com and search for a user, everything works like it is supposed to, redirecting me to mydomain.com/users/brad but if i then do a url search formydomain.com/users/brad i get a not found error, any help is appreciated!
In my case, when I have to serve static content with nginx, it often looks like :
location /static {
alias $myroot/staticfiles;
}
Also, if you haven't already, read the NginX guide to Serving Static Content.
If your are familiar with the Docker technology i would recommend to use a Docker Nginx Container and add your static content from the Webpack Buildflow to your container (this can be automated with a build server). Have a look at the following Docker Image from Nginx: https://hub.docker.com/_/nginx/.
Otherwise you have to install nginx on your Server where you host your Homepage. For this have a look at your Server OS and reach out to the web for a detailed nginx setup for your server. Without any configurations nginx will serve the static content on Linux-like server from /usr/share/nginx/html
If you only have FTP Access to your server you can transfer your built files via FTP/SFTP to a specific folder e.g /myHomepage and then your static content is server from yourdomain.de/myHompage.

Golang app on Heroku htaccess basic auth

Is possible use htaccess on golang application running in heroku??
I had read this link but the solution doesn't work for me (also, the command htpasswd is not recognized in the heroku bash, but I made the htpasswd file usin this tool).
Thank you.
A Go web application is a server so no need to use Apache httpd server, especially on Heroku that has crystal clear deployment instructions for Go :
https://devcenter.heroku.com/categories/go
Follow these instruction closely and you'll find out there is no need for Apache.
htaccess and htpasswd are related to Apache httpd server, they are Apache configuration files.
Finally, Go standard library gives you all the tools you need to implement basic auth yourself :
https://golang.org/pkg/net/http/#Request.BasicAuth

Is it necessary to restart node.js's http-server when updating html files

I can't find anywhere an answer for this: do I need to restart the simple http-server if I edit client files like .html, .css or .js (e.g.: index.html) from the directory the server is based on?
I want to use http-server for development phase, when I edit various files multiple times.
Note: this question is not related to How can I edit on my server files without restarting nodejs when i want to see the changes?
No. The simple http-server should recognize any changes you make to static files like html, css, and js. The simplest thing to do is give it a try.
The http-server uses ecstatic to serve static content. This library returns a Cache-Control header where default timeout is 3600 seconds (1 hour). You can change the timeout by specifying cache (in seconds) in the options you pass to http-server - which in turn will be passed on to ecstatic

How can I use (Node) Livereload on a development server in my network

Background: My PHP projects (CakePHP, Wordpress) run on an Ubuntu server in my network, I access them through a development TLD (.dev for example) setup through a local DNS server and I edit the files through a Samba share.
I would like to utilize Livereload for my development, preferably have it running on the server itself. I have basic Node/Gulp knowledge, but haven't been able to get this running.
Livereload (or a middleware server) should proxy the 'real' URLs, making sure all websites run as they would normally and Livereload should be available over the network (so not just localhost, because that runs on the development server)
Desired result:
Livereload runs on my dev server (IP: 10.0.0.1), my project is called helloworld.dev, I browse to 10.0.0.1:3000 on my machine and see helloworld.dev proxied through Livereload. I now edit a CSS file over the Samba share and the CSS is reloaded without a refresh.
I've tried using a few NPM packages, gulp-livereload, livereload, node-livereload, with their provided examples that come with the packages, but haven't been able to get the desired result. They all expect you to run in locally, don't support access to the Livereload URL over the network, cannot proxy the 'real' URLs or require static content.
Can anyone provide an example or 'proof of concept' code of my wish, so I can see where to start?
I found the answer: http://nitoyon.github.io/livereloadx/
This does EXACTLY what I need.
I can run
livereloadx -y http://helloworld.dev -l
open
http://serverip:35729
and I'm ready to roll.
The -y option creates the proxy to the 'real' URL and the -l makes it serve files from local filesystem instead of through its proxy.

Resources