Blazor PWA Offline Caching while deployed to a Subdirectory - caching

I followed this Blazor PWA Guide in order to create a PWA. This works seamessly when I deploy it directly under my site (or subdomain) such as https://example.com or https://myapp.example.com
However, I want to host this under an IIS subdirectory such as https://example.com/myapp
Problem now is that the service worker doesn't seem to correctly cache/load the assets while doing this. I have been trying to figure out what I should change in the service worker in order to make the cache work but can't get it right.
The service worker I am using is the one that comes with the blazor wasm template, which can be found here
How can I edit the service worker to work under a subdirectory?

Related

how heroku, netlify, godaddy are different in terms of the web hosting service it provides

If I want to have a react app hosted on my owned domain what is my best option ?
1) Godaddy webhosting
2) heroku
3) netlify
I not sure what are the differences, what shoud I choose, I want CI/CD to be setup and, each push to my repo on github should trigger a deployment
Heroku and Netlify have good CI/CD support. With Netlify you are more limited since they host static web pages. You cannot do SSR (server side rendering) with Netlify.
It depends entirely on your project. If you have a project that requires SSR go for Heroku. If you have a project that is a SPA go for Netlify. When combined with GitHub it can be especially nice.

Live debug .net core microservice in visual studio that’s hosted locally in kubernetes on docker desktop

I have set up a simple kubernetes environment on my PC using docker desktop and have a basic ingress controller.
I would like to live debug an Asp.Net Core web api microservice in visual studio that receives a call through the ingress controller so I can do an end to end testing from my front-end.
I can’t find any information on whether this is possible or how other people setup their dev testing environment. So far I have tried using an ExternalService in kubernetes but can’t get it to work with localhost and tried to create a redirect from the ingress controller that just forwards calls on from a certain path but again couldn’t find an approach that worked for me either.
If anyone could tell me if the approaches I am taking work and how to do it or if there is another approach I’m missing, I’d much appreciate it

Webserver for Angular and Spring application

I'm building a small web application for a personal project. It will be an Angular web application which will talk to a Spring-Boot service layer which in turn will read/write stuff to MongoDb.
I hope to host all this on a single EC2 instance in AWS. My question is how to configure a web server (like Apache but doesn't have to be) to 'beautify' the URLs a bit. Example, without touching anything angular will run at something like host:4200 and the service layer at host:8080. I will then have to map a proper domain to host in AWS, but the hiding of ports etc is where it gets murky for me.
I want to be able to hit my web app at domain.com (no ports etc) and I also want my service layer to ideally have a similar setup e.g. domain.com/service (no ports etc).
How do I configure a webservice to do this for me? Examples or pointers to specific examples would be ideal, but even a pointer to the right documentation will be helpful.
This thread is kind of similar to what I want but not too helpful: How to deploy Spring framework backend and Angular 2 frontend application in any online server?
You can use a setup with AWS CloudFront as reverse proxy and CDN cache. You can map the Domain Name and SSL Certificates(You can use AWS issued free SSL Certificates through AWS Certificate Manager) to CloudFront while the EC2 instance is plugged as an origin behind CloudFront as shown in the following diagram.
In the diagram I have optionally added, which is a common practice in designing applications in AWS.
Hosting the Angular App in S3
Using Autoscaling & Loadbalancing for EC2 instances.
You need to use Apache or other web server as a reverse proxy. Start here -
https://devops.profitbricks.com/tutorials/configure-apache-as-a-reverse-proxy-using-mod_proxy-on-ubuntu/
You then will need to setup a custom domain name. The easiest option is to just use an ELB (now called Classic Load Balancer). More details are here -
http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/using-domain-names-with-elb.html

Uploading Angular 2 app to web hosting

So far I've used web hosting such as https://uk.godaddy.com/hosting/web-hosting for my websites, but seem like running angular 2 app has different way for publication.
So, since I found nothing about running Angular 2 app to be available public, and not only in localhost
My questions are -
What providers do allow such apps to be hosted on them? now I'm using npm start in my project folder to run my app, does it works the same way?
Since my backend is Laravel and supposed to be in the same domain as the Angular2 frontend, These providers allow to host the API's too?
Thanks in advance!
I have also hosted my laravel backend and angular front end using openshift. In terms to your application, I recommend you the following two providers.
Amazon Web Service. You can get 1 year free trial, EC2 is really wonderful to host whatever you want. In EC2, you can configure the environment for angular 2 and laravel by yourself. You can run any command including npm install in EC2
Openshift. You can freely create 3 gears to host your application. The environment is very easy to configure. If you want
to deploy angular 2, laravel applications, there are specific gears for these frameworks, so openshift
should be the best choice.
The answer to your second question : Yes, they allow to host the APIs !

Can I host index.html (homepage) on the Rackspace CloudFiles CDN?

I want to make my web app fast, especially the first page load (index.html).
Can I do this by hosting myfastapp.com on Rackspace CloudFiles and then have a subdomain called nodeserver.myfastapp.com which connects to a Node Server on Joyent.
Note: The node server will only connect via socket.io to tell the client which additional files to grab from the CDN (myfastapp.com).
There's a guide for this in the Cloud Files docs at Create Static Website.
There should be no issue with that the logistics of that.
The main issue is getting the main site on Cloud Files due to cname restrictions, at least in the Rackspace system, but it can probably be done.

Resources