How do I enable SSL/HTTPS on KeystoneJS - node.js

I have just started looking at KeystoneJS v5 and I am now trying to set up a passport auth strategy locally (in my dev box) using Facebook. Unfortunately, in order for this to work the site must be served encrypted. How do I serve the KeystoneJS site using ssl/https on my dev machine? I'm on Ubuntu via WSLv1.

I ended up just putting Nginx in front of it...

Related

ERR_CONNECTION_REFUSED on EC2 public DNS caused by HTTPS

I'm developing a web app using Next.js that is, in the end, served by a custom Express.js server. I'm trying to deploy this app on EC2 and access it but I'm getting ERR_CONNECTION_REFUSED errors.
I'm accessing the app over HTTP using the public DNS of my instance (http://ec2-PUBLIC_IPV4_ADDRESS.compute-1.amazonaws.com/) which works fine, the index.html then needs to load other files (e.g.: .js or .css files), but tried to load them over HTTPS (https://ec2-PUBLIC_IPV4_ADDRESS.compute-1.amazonaws.com/style.css). In the network tab of the developer tool of Chrome, I get one request that is succesful and other assets that fail with net::ERR_CONNECTION_REFUSED.
I was wondering if there is a config either on my EC2 instance, on my Express server or even on Next.js that needs to be modified to make sure that the connection is not upgraded to HTTPS.
I would prefer to find a solution that doesn't involve setting up a domain for early testing purposes.
Thanks in advance.

How to deploy whole Wordpress app in Nuxt app?

Is there any possibiliy to deploy full wordpress app in Nuxt app? I mean I want to have adress foo.com of my app and on foo.com/bar will be wordpress app. Is there any way to do this? Nuxt router will be able to deal with this?
Wordpress API and iframe aren't answers, which I look for. As I said i want to deploy whole wordpress on specific adress of my Nuxt app.
A bit of background
NuxtJS (build as static) is a client side app.
WordPress is a PHP server side app
A wordpress site usually get served to users by web servers like apache or nginx.
Client side apps served by any web server (including apache or nginx)
So you can't "deploy wordpress in nuxt", but it is simple to get what you want:
Follow this guide to move the wordpress to a subdirectory
Upload the nuxt app to the root directory
In case you are using SSR or any other requirements that force you to use Nuxt in server mode, your options are:
Setup nginx as reverse proxy
Setup apache as reverse proxy
Setup a proxy in the node server itself, maybe this project could help
I think there may be a problem with this without the wordpress API, but the question is, do you care about Nuxt.js or maybe just Vue is enough? Remember that in Vue 2 you can use an inline-template, thanks to which you can render elements on the server side. For this you will add the necessary elements from the Vue ecosystem, such as a router and setup you will have similar to Nuxt.js.
Example code:
<div is="navbar-dropdown" inline-template>
<div v-cloak :class="isOpenDropdown ? 'visible opacity-1 mt-0' : 'invisible opacity-0 mt-10'">
<?php get_search_form(); ?>
</div>
</div>

Is it possible to host Wordpress Blog under route of React App

Is that possible to host a Wordpress Blog under a route in my React Web App?
For example, my React App is running on domain www.myreactapp.com, can I host a Wordpress blog under route www.myreactapp.com/blog.
When I worked with PHP Web APP, it was easy, you just need to create sub-folder named "blog" and install Wordpress in it. I am hoping to get a solution like in PHP Apps, if yes I can just make use of all features of Wordpress with less amount of coding.
Thanks in advance
You cannot do it directly as WordPress have its own configuration which is necessary for WordPress website due to which admin panel will not work, but you can use WordPress API to load the data you wanted from WordPress and show in react app.
I am not sure this is exactly what you wanted or not but you can also setup the WordPress separately in sub domain like http://blog.myreactapp.com
Also let me know if you found any working solution
All,
We can host the Wordpress blog along with React App like in the question(for example www.myreactapp.com/blog).
Steps
Use Nginx to host the React App
Install Wordpress
Add a rule in Nginx to proxy the request to WordPress when the request comes to /blog. http://nginx.org/en/docs/http/ngx_http_proxy_module.html
Hope this helps
Thank you

Django and Node processes for the same domain

Hi I have two process
Django and MYSQL
node/express and mongo db.
1.
How can I configure this two process to point to different url
like. Django point to api.abc.com/v1 and node point to api.abc.com/v2 ?
2.
all my user login is inside Django and MYSQL with OAuth. I can authenticate user in Django.
But how can authenticate user in nodejs app with the token send by Django REST OAuth ?
Thanks.
You can do it in few ways but the most convenient method would be to use a reverse proxy like nginx.
Configuring the reverse proxy for your Node app and doing exactly the same for your Django app will let you easily have the routes that you require, on the same domain name and port number just in a different path.
Another option would be to proxy requests either from the Node app to the Django app or the other way around, but that would require changing your applications instead of just putting a proxy in front of them.
Here are some questions with onfo on how to configure reverse proxies for Node using nginx, Apache and even Microsoft IIS:
NGINX Reverse Proxy Causes 502 Errors On Some Pages
reverse proxy using ngix and ssl implementation on express failed
SSL With node / IIS
Adding chat through websocket, to an existing PHP web app
Where do I put my Node JS app so it is accessible via the main website?
How to run nodejs server over 443 ensuring nginx doesnt stop working
Configuring HTTPS for Express and Nginx
Scenario A
You create a url in django ^v2/.*$ and then make a request from django view to node.js process. this way django can handle user auth and permissions and node can be standalone and not know anything about user auth. If you need user data (id or something) you can inject it in the request as a header or a cookie.
Scenario B
You dig into django REST OAuth implementation, find where tokens are stored in db, and on each request you take the oauth token from the header/cookie and compare it to the one in DB. You would have to setup nginx as a reverse proxy and route all traffic that goes on url /v1/.*$ to django app, and all traffic that goes to /v2/.*/ to node app.
Either options are doable but I would suggest Scenario A. It's easier, quicker and far less error prone.

Integrating node.js and express website with wordpress hosting

I have a website running on node.js and express, hosted on Amazon EC2 with a normal domain (e.g. www.example.com)
We want to add a blog to the website. We would like the blog route to be www.example.com/blog
I have tried a Ghost installation under node.js (with a proxy layer to handle the port and url remap). I got it working ok, but the feature set is not robust enough for our content creators. They would rather work with WordPress.
But WordPress does not have a node.js install, and I do not have the bandwidth to set up and run a WAMP server in addition to the node.js server we currently use.
So I am investigating using a another hosting option for wordpress and using a proxy layer to redirect to the hosted wordpress blog.
From what I have read online, WordPress hosting will not work (cannot configure the URL properly on the WordPress side). And I could not get the proxy layer to work with a test account.
Will a 3rd party (like GoDaddy) work?
I am envisioning that we host the blog on GoDaddy. And on our site, I set up a proxy to map www.coursehunter.org/blog to the GoDaddy hosted Wordpress blog. Has anyone done this? Does it work technically? I understand I would probably have to edit the .htaccess file.
Are there SEO gotchyas from an implementation perspective? The main point of our blog is to build out content for our main domain which is why we want the www.example.com/blog url.
Thanks!
I would suggest you look into Nginx web server. You can set it up as a reverse proxy for your NodeJS/Express web application and install its php-fpm module to handle the PHP part(Wordpress).
Here is a guide to set up Wordpress with Nginx https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-ubuntu-14-04
And here is one with set up your NodeJS application with Nginx https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04
In your case, you will need to setup the url configuration so that the parts get routed to the correct destination that is NodeJS part is handled by reverse proxy and Wordpress is handled by php-fpm

Resources