How to install create react app via http? - npm

For some network issue that I'm working in, I couldn't install packages properly via https protocol. Is there any way I could install create-react-app via HTTP?
I've tried this using offical git URL but it doesn't work either.
"dependencies": {
"create-react-app" : "http://github.com/facebook/create-react-app.git"
}

GitHub will not permit you to use HTTP. This is good. They don't want people trying to use man-in-the-middle attacks on users of the site to inject malware etc.
If the git protocol isn't working for you either, you can try the SSH protocol: npm install git#github.com:facebook/create-react-app.git
If that doesn't work and the problem you're having with HTTPS is cert validation, a less-good solution is to temporarily turn off ssl-strict in npm.
If you're having a larger "network issue" such that you can't get to GitHub over HTTPS at all (even in a web browser, let's say), I'd recommend fixing that rather than trying to work around it. In that situation, it's likely far more than just that is broken for you.

Related

Ngrok and npm explaination Wix API AuthO

Am working on a API with Wix, and ive been able to get everything working, But there is one eliment i cannot automate or account for because i have no idea how its working or understand it properly.
I have been following: https://dev.wix.com/api/rest/tutorials/create-your-wix-app
It advises me to use Ngrok and also Npm after downloading some sample skd.
WHen setting up the App, it asks for a Redirect URL (When users authorize your app, we’ll redirect them to this URL with a temporary authorization code.)
It also asks for: App URL (When users start to add your app from the Wix App Market, we’ll redirect them to this URL.)
What i cannot understand is how Ngrok allows and uses the urls in the tutorial
As there is no physical files for these calls?
https://<NGROK_STRING>.ngrok.io/login and https://<NGROK_STRING>.ngrok.io/signup
I peronsally thought it was just a URL it called and passed back the Auth code, So i created a PHP page that fetched the string behind code: in the url so it can email me or save to file,
But this just does not work.
(I have it working in ngrok and npm, but i cannot have these running every time a user wants to download the app and link into our system)
I cannot understand the use of npm and ngrok, am presuming there is some sort of handshake somewhere.
Is this the correct way, do i have to install these programs on the a dedicated server and have them running at all time incase someone installs the app?
Is it not possible to just have the AUth code sent to me so i can finish the setup, generate a refresh token and be done with all the ngrok and npm
I'm not sure if I understand you correctly. So I'm gonna explain NPM and NGROK quickly.
NPM = node package manager -
npm is simply a package manager, so you can use it if you like to. Especially with node.js you are most likely gonna be using it. But with PHP npm might be used in your development enviroment so for example PHPStorm to get the packages you need. So no direct connection to WIX.
NGROK -
Is used to redirect traffic from a semi-permanent ngrok URL to a likely dynamic IP like from your Computer. In my case I work on localhost, and NGROK just relays the calls from wix to my localhost where the application is running. This is needed, since stuff from the internet can not simply access a computer. That's what NGROK is for.
If you have a ready application, you should not need ngrok, aslong as you have it running on a server somewhere. "Just" replace your NGROK urls with the actual URLs of your server.
I hope this helped =)

HTTP/2 long timouts at HTTP_TRANSACTION_READ_HEADERS

The Issue:
I've recently been working enabling HTTP/2 for a large PHP+JS application (generally a Backbone-based SPA served by a PHP back-end). While most resources load fine, two requests are getting stuck in the "Stalled" state for exactly 5 minutes before resolving and downloading as normal.
The two request in question are a simple XMLHttpRequest to our back-end and a request for a Font Awesome font file. Other font files and back-end requests are loaded just fine, but these two will consistently hang up when HTTP/2 is enabled.
Debugging Information:
Here are the headers associated with the font file request listed in Chrome's dev tools:
...and here's the output from chrome://net-internals, with the hangup occurring at HTTP_TRANSACTION_READ_HEADERS (see the dt of almost 30000ms):
Further Details:
This application is served using a build of apache2 that includes the mod_http2 module rather than the standard version of apache2 that is packaged with Ubuntu. The same behavior is reported in the latest versions of Firefox, Chrome, and Chrome beta on Ubuntu 16.04.
For the sake of local development, all SSL is being run through a self-signed OpenSSL certificate, generated with OpenSSL version 1.0.2j.
It should also be noted that all other successful requests are running through Backbone-related methods, which delegate to jQuery's $.ajax, where the failed XMLHttpRequest is using the native JS XMLHttpRequest Object.
Thanks for your help.
What version of Apache and mod_http2 are you using?
There's been a load of fixes for this sort of thing and Apache 2.4.25 is about to be released including those fixes, so suggest you upgrade to that when it comes out in next day or two and try again.
Alternatively, if you don't want to wait, you can try updating mod_http2 independently by doing the following (assuming Apache is installed in /usr/local/apache2/ but adjust that as appropriate):
#Download and install mod_http2 outside of a regular Apache release
#Latest version is here: https://github.com/icing/mod_h2/releases/
wget https://github.com/icing/mod_h2/releases/download/v1.8.3/mod_http2-1.8.3.tar.gz
tar -zxvf mod_http2-1.8.3.tar.gz
cd mod_http2-1.8.3
./configure --with-apxs=/usr/local/apache2/bin/apxs
make
sudo make install
Then restart Apache and confirm from error log that you are running mod_http2-1.8.3.
If that doesn't work then raise an issue here: https://github.com/icing/mod_h2/ as the mod_http2 developer (#icing) is very responsive to issues. Assuming this is an Apache bug of course.

Safari Localhost Permission Blocked

So ran into this issue today, where I have a website that needs the geolocation of the user. It was working fine when running locally on localhost, but now I get an error saying "Access to geolocation was blocked over insecure connection to http://localhost:4200". WTF Apple? I also tried 127.0.0.1 but got the same result. Am I missing something in the dev settings or did Apple just break everything?
Safari Version: 9.1.3 (11601.7.8)
Maybe it's possible to use https ( How to get angular-cli to ng serve over HTTPS ) and if not is possible directly for some reason maybe you can use a transparent proxy that offers https.
Many HTML5 new features like access to webcam, geolocation and others are now allowed only on pages served thru https scheme, so probably using https will work again. If not, maybe is possible to modify hosts file to workaround the problem.
I found a sort of solution but it is a bit tedious. I use ngrok to route my server and then the geolocation works fine. The only thing I don't like is that it has limits (if you are using free account), like you can't refresh a lot of times.
edit:
To Use ngrok download it first, then on terminal type
./ngrok http <port number>
ngrok example.
It will then show you the url routes. I used https. Go to to that address.
More ngrok instructions and download

Mod_Spdy not running on Centos

I'm setting up Apache on Centos the way I have done in the past, but for some reason mod_spdy is not running. I'm following the instructions here:
https://developers.google.com/speed/spdy/mod_spdy/
When I run rpm -U mod-spdy-beta_current_x86_64.rpm I get this message:
warning: mod-spdy-beta_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
package mod-spdy-beta-0.9.4.3-420.x86_64 is already installed
If I open chrome://net-internals/#spdy and my site in another tab, it doesn't show my site. If I look in the network panel, I don't see the x-mod-spdy header.
Update: If I use Firefox firebug, I see the x-mod-spdy header. I don't see my site in Chrome spdy sessions, but I see other sites in it.
What could I be doing wrong?
Ok it seems the issue is that Chrome 40.x dropped support for SPDY/3 and only supports SPDY/3.1, but the mod_spdy module for Apache only supports SPDY/3, so basically no SPDY for Chrome users if you use Apache as a web server.
mod_spdy is currently in a bad state where either Google nor Apache is maintaining it after Google donated it to the Asf. Google recently made the statement that they will drop the SPDY support from Chrome in early 2016, but what they forgot to say that they started dropping older versions of SPDY already (including SPDY/3) (I like these partially true statements by the way), so basically if you are on Apache then for your Chrome users you can't provide SPDY short of implementing SPDY/3.1 yourself.
So, how was that "do no evil"? :-)
See details: https://groups.google.com/forum/#!topic/mod-spdy-discuss/FPEj0zG5I0Y
and https://code.google.com/p/mod-spdy/issues/detail?id=100&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20Stars
One option you might consider is switching to Nginx and using SPDY/3.1 over there.

how to test open graph on localhost

I've done a lot of research and haven't found a definitive answer to this. Is there anyway to test the open graph on localhost? I don't haven any issues using the graph api on locahost.
I've changed my website url in the app settings and have even tried setting up a domain in my hosts file but the debugger linter for open graph tries to use the actual domain instead of my localhost and when using locahost directly the linter completely fails connecting.
Does anybody have any workarounds for this?
Using a local proxy is the right solution. ngrok didn't work for me neither.
A similar tool that did work with facebook debugger is localtunnel ✅
npm install -g localtunnel
lt --port 8000
# or using npx without installing localtunnel
npx lt --port 8000
Generates a url that looks something like https://<random_hash>.localtunnel.me/. Using this url in facebook open graph debugger worked for me as of October 18th 2017. I only had to hit Fetch new scrape information button. 🍻
Cool thing about localtunnel is that you can easily host your own localtunnel server with github.com/localtunnel/server so if it ever stops working with localtunnel.me, you can run your own somewhere in the cloud ⛅
You can use ngrok to create a random public subdomain that routes to your local webserver very easily, even through NAT or firewalls.
Just download ngrok and run ./ngrok http 8080 (assuming 8080 is your local webserver http port).
This will create a random subdomain like http://38a84a97.ngrok.io/ that routes to your local webserver and that you can use with Facebook to test your open graph tags.
Its very simple to test Open Graph in any local environment using Chrome or Firefox using plugins. I have used one to quickly show in chrome how the Open Graph looks to the viewer to test results. Here is a quote of what it does.
This extension shows how people will see your site in the most popular
social networks This extension is for professionals who creates a
media content.
To check meta-information of your site or article just open it in a
Chrome and click extension's icon. Also you could add an URL manually.
Here is a direct link to the plugin (Chrome)
Firefox add-on
As a bit simpler approach you can use a browser extension like https://socialsharepreview.com/browser-extensions - which will show your Social Cards directly in the Browser (which of course might fail, if you wrongly didn't set them serverside :))
To test open graph (and Twitter cards) I also had to expose localhost (Docker) to Facebook and Twitter. I used Serveo
It works very well for this, no need to install anything as it works with ssh port forwarding.
$ ssh -R 80:localhost:3000 serveo.net
Then navigate to the url given, and there you go.
You have to setup a public domain which points to your public ip address.
Use dynes.org or a similar service and setup your router to forward your port 80.
There are several tools you can use for serving something up over your localhost, each with varying degrees of functionality.
I prefer (obviously) http://forwardhq.com
Other great options here: http://devblog.avdi.org/2012/04/27/http-forwarding-services-for-local-facebook-development/
If anyone is looking to preview the :og tags on while developing on subdomains (using lvh.me) in localhost. You can use https://serveo.net.
Simply use following command to forward your local server requests. No installation required.
ssh -R yoursubdomain.serveo.net:80:yoursubdomain.lvh.me:3000 serveo.net
you can put your desired port in place of 3000.
Reference: https://blog.aarvy.me/2019/09/20/expose-local-apps-having-subdomains-to-web/