How To Setup Https In Nest js (Official doc solution is not working) - node.js

I have two B/E servers and both of them deployed in an SSL environment.
EX:- https://one-xxx.com/ and https://two-xxx.com/
And I have a strategy like this.
https://one-xxx.com/api/v1/get -> https://two-xxx.com/api/v1/get
When My F/E application makes a request to the first E/P and it is going to hit the second E/P (Just like reverse proxy).
When I make a request for this E/P it's returning this error: Error: unable to verify the first certificate.
I google this error and found out what is going on and this solution for nest js. (It's on nest js official doc). But the problem is when I apply those changes to both my B/E server My Error remains the same. I really need your help on this. Thank you!

Related

I have a problem with my NODEJS API on planetHoster

I created my very first NODEJS API. Locally, it works well but I just hosted it on planetHoster and it doesn’t work anymore. When I enter my query, I find the error "Cannot GET/Nodev2/idcc/list" then my route was functional locally. Do you have any assumptions? Thank you in advance!
I can share my code if you want see
I tried to change directory/file names

Deployed angular project 'GET' request not working

I have an built angular project that I'm trying to run. I have copied the folder that I got from 'ng build' and put it in the folder where I have my back end code (used express). I'm running it on my laptop at port 3000.
While all the post requests in my application work fine, none of the GET requests seem to work.
Here is the exact error I'm getting.
If more information is needed to find out what I'm doing wrong, please ask.
Edit 1:
This is what I'm getting in the network tab. The response says html. But when I was working before deployment all my responses were coming as intended.
After looking into the images that you mentioned here, it look like that is has a http failure duing parsing in header:
Take a look here in order to resolve the same:
https://github.com/angular/angular/issues/18396
Thanks

How to connect angular2 server side with php

I recently bought a new template for my site written in angular2, i did a short course on it and started to work and everything fine.
Now come the the part where i try to connect it to my DataBase and i cant figure it out...
after a little bit of reading i saw that i need to use nodejs in order to speak with the server side, is that true?
can i use php or i must use the nodejs api to work with my Db?
am i missing the concept of the angular2 or something? can someone post a basic script of angular working with php example , i just cant find it.. :(
thanks a lot :)
The most common scenario is that you use the Http service in Angular that makes XHR (Ajax) requests to the server to fetch data (not HTML).
You can use any server that is able to receive, process and response to XHR requests. Therefore PHP is as suiteable as node.js (or .NET, Java, or any other web server)
See also https://angular.io/docs/ts/latest/guide/server-communication.html

Express route with multible slash - Linux & Windows difference

I have encountered a strange behaviour with express routes. I want to enter an ID via HTML-Form and fetch the result via ajav (jquery) to display the entry. All was working fine, till i have to expand the ID from numbers to strings (with slashes).
I edited all functions and calls. I check the strign with a reg ex and want to fetch the request with a modified route (express). but here comes the problem. i get it working under windows but it is failing on linux. Perhaps the problem is caused by the invrastructure, because the node.js app is located behind an reverse proxy apache2 to tunnel the service to public (with domain & cert).
what ever. perhaps somebody can help me set this thing up and get it running.
app.get(/^\/byId\/(.+)/, getSourceById);
not using req.params[0] in the called function. on the test server (windows) it is working even with the old route
app.get('/byId/:id', getSourceById);
because the html form does request %2F not /. How ever, both ways should work to fetch the request. But both aren't working for me. did i miss something?
i'm thankful for any help!
Found the answer of my question. It was indeed the reverse proxy who was blocking the request.
Simular problem: http://www.gossamer-threads.com/lists/apache/users/314562
How to solve the behaviour:
http://httpd.apache.org/docs/2.0/mod/core.html#allowencodedslashes
Default forbidden because of security issues. If you need it, use it carefully.

Allowing cross-domain calls with Yeoman (1.0) grunt server

I've been using Yeoman 0.9 up until yesterday when I decided to use the beta 1.0 release on OS X. I use Yeoman to develop an angular app.
With the Yeoman 0.9-->1.0 migration of my app done and working, I'm now keen to extend the dev server fired up by yeoman grunt server to allow me to make cross-domain calls to an API developed by another team, hosted on another server, where they've already allowed cross-domain calls. Up to now we've been using a fake http backend courtesy of angular.js.
--An aside--
If anyone's reading this looking for a quick solution, we got cross-domain calls working by passing the --disable-web-security option to Chrome from the command line using this approach on OS X with Chrome, but it turns off security for all of Chrome (thumbs down) and we can't get Chrome to fire up as a new instance anyway.
--End aside--
Through some digging I found this Stack Overflow post (via the answer to this post) giving me a pretty good idea on what I need to do to get grunt server allowing cross-domain calls.
It essentially involves adding a middleware component to connect to allow alter the headers so that "Access-Control-Allow-Origin" is set to "*" or whatever one likes.
Knowing nothing about Node.js, I can see the change alluded to in the post needs to be made somewhere in the many files created by Yeoman, but where? I've done some raw string searches for "app.configure" and "connect.listen" within the "node_modules" directory set up by Yeoman but I come up with a number of hits, most of which are from examples bundled with the modules and it isn't clear to me which I should edit. In case it helps, here's a snapshot of the directory structure for my angular app:
If anyone can give me some pointers on where these changes may be made I'd really appreciate it!
Solved sans messing around with node using the approach in this github pull request: http://github.com/angular/angular.js/pull/1454
You can use Apache proxy and connect your REST server with gruntjs(angular.js).
Apache would do this:
proxy / -> gruntjs
proxy /service -> REST server
you would use your application hitting Apache and angular.js application would think that is talking with itself so no cross domain problem.
Here is a great tutorial on how to set this up: http://alfrescoblog.com/2014/06/14/angular-js-activiti-webapp-with-activiti-rest/

Resources