Why doesn't Chrome recognize my progressive web app? - google-chrome

I made a progressive web app with a nodejs backend. When I deploy it on my server, chrome does not recognize the app as a PWA. All other browsers do (firefox, opera...). This means I don't get the "download" prompt or the full screen view of my app.
It was working perfectly when it was deployed on heroku. I bought hosting and now it doesn't work. The main difference is that the app now runs on port 8443 because port 433 is used by a webserver. I looked on google and found that chrome only recognizes PWAs if they run on port 433. I asked the helpdesk and they told me to use a .htaccess file. I have not worked with one before and it does not seem to fix my problem. It automatically redirects to port 8443 but Chrome still does not recognize it as a PWA. This is the .htaccess I use:
SetEnvIf Request_URI "^(.*)" PORT=8443
RewriteEngine On
RewriteBase /
# CORS
Header add Access-Control-Allow-Origin "*"
# HTTPS
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# PORT
RewriteCond %{SERVER_PORT} !^%{ENV:PORT}$
RewriteRule ^(.*) https://%{HTTP_HOST}:%{ENV:PORT}%{REQUEST_URI} [L,R=301]
# RPROXY
# RewriteRule ^(.*) http://localhost:${ENV:PORT}/$1 [P]
I was wondering if the problem really occurs because the app runs on 8443 or if there is something else I don't know.
thanks!

I haven't tested this, but maybe using vhost and reverse proxy, so you can still serve your app on port 433 but reverse proxy the requests to your node server running on a different port.

Related

Self Hosted Website www redirect to non www

I am self hosting a website on a Synology NAS. I have set up an SSL certificate, set up the DNS records on Google Domains. If I enter the website, andrewr.ca, into a browser it works fine. If I enter www.andrewr.ca it does not work and the SSL is not valid. I am trying to figure out how to fix this issue but get stuck every time. I have a .htaccess file that looks like this:
And my Google Domains account looks like this. [enter image description
My SSL cert looks like this:
Could someone please point me in the right direction here. I just want to be able to enter www.andrewr.ca and it works the exact same as if I enter andrewr.ca
I have tried changing the CNAME, changing the .htaccess and also adding a different SSL certificate but had no luck with anything I try so far.
This honestly probably has two separated answers out there for you to find, but I am posting this just because it's a solution we use currently in our setup to rewrite non https to https AND non www to www in one swoop. These are the rewrite directives in my production .htaccess
#SSL = 1
RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteRule ^/?(.*)$ https://example.com/$1 [R=301,L]
# Redirect www and http to https - non-www
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
This is not for everyone and ONLY works if you have a single domain in your setup -- Which the top two lines of the htacces file there are put there to deal with multiple domains on the single files set to canonicalize the domain .. Once you have multiple domains in there .. You WILL NEED a separated SSL for each domain, AND the www for it to work .. But as for a SINGLE domain, this will forward to https - non www without the need for a secondary SSL on the www

Redirect http to https google cloud load balance

I have created https load balance and added ssl certificate. site working with https:// but its not working http:// and getting 404 error
Added Headername as X-Forwarded-Proto and avlue as https in load balace header request
Added in .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
is there any to redirect http to https to avoid 404 error?
At this time, there is no way to directly configure the GCP Load Balancer to redirect traffic from HTTP to HTTPS; however, there is a workaround to do this. Using Nginx, you can add the following string within the nginx configuration file:
if ($http_x_forwarded_proto = "http") {
return 301 https://$host$request_uri;
}
If you are using Apache, then you will have to do the following if you want to redirect the traffic using the .htaccess file:
Run either "sudo a2enmod rewrite" or "LoadModule rewrite_module modules/mod_rewrite.so" depending on the Linux OS you are running. This will enable
Edit or create the .htaccess file in the domain root directory with the following:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
You can find more details on the following link here.
There is also an internal request to have this feature added within GCP HTTP/HTTPS Load Balancers. I cannot provide an ETA on if/when it will be applied; however, you can follow the Public Issue Tracker (PIT) on the progress of the request.

polymer 3 starter kit: The requested URL /view1 was not found on this server. But just on internet

I init the polymer 3 starter-kit and everything works fine on local server with polymer serve
But if I upload the app to an online server and refreshing the page I get an error: The requested URL /view1 was not found on this server.
To be clear. Everything works fine if I use the menu. Then the url changes to domain/view1 and if I refresh the page at this point I get the error.
Ok, I got it. I configured the .htaccess like this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /

Web Browsers Don't Pick Up SSL Certificate

I am setting up a ssl certificate for a website
http://www.wegetitall.ca
I have checked it with many different ssl checkers and everything is ok but neither chrome nor internet explorer pick it up. There is no lock sign in chrome and it doesn't even say the certificate is not secure, it just doesn't see it at all.
The certificate was bought from godaddy and more information about it can be found here: https://www.sslshopper.com/ssl-checker.html#hostname=www.wegetitall.ca
What could be the reasons it doesn't show?
I can see SSL connection with your website.
When you connect to your website, make sure you type https:// .... NOT http://
if the connection is http, you can redirect to https.
Check this thread for redirecting (it's based on a server with PHP running. Find the correct one that's applicable to you).
SSL is installed well you just need to redirect to HTTPS
Put following code in your .htaccess file.
RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.wegetitall.ca%{REQUEST_URI} [R=301,L]

(HTTP) Hide page extension in the URL

I'm making a web page using my Raspberry PI and Apache. I made the page chat.html.
To connect to it I have to write in Chrome "http://192.168.1.39/chat.php". How can I hide the '.php'(or anything else) from page URL, so when I connect to "http://192.168.1.39/chat" directly it doesn't give Error 404?
Thank you in advance.
Use URL rewriting by utilizing .htaccess. Basically .htaccess is a file that let's you alter the config of a webserver like Apache.
In your web site root, create a filed called .htaccess.
Paste this in it:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
*.php files can now be accessed the way you describe. For more info on htaccess and url rewriting, please reference http://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/