I have developed a NodeJS app running on port 1234. In order not to have ":1234" in the address bar, I use proxypass/proxypassreverse so that the URLs look like "mysite.com/myapp/".
Everything works fine but my app is behind a SSO. When a user tries to reach "mysite.com/myapp", he's redirected to the SSO, he logs in, then the SSO redirects him to "mysite.com:1234" (because the SSO doesn't understand that there is a proxypass).
I created a javascript on my page detecting if there is ":1234" in the URL and if so, the window.location replaces ":1234" by "/myapp".
This is not a very good solution for me, I think there may be a NodeJS or even better an Apache solution to detect if the URL reached is the ":1234" one or the "/myapp" one.
Thanks in advance.
OK my problem was that NodeJS sent to the SSO the URL with the port number. All I needed to do was to replace the port number by the string I use for the ProxyPass:
req.get('host').replace(':' + PORT, '/node')
Related
I am new to nodejs so apologies if this is a bad question.
I am using NodeJS + Auth0 to authenticate a shiny webapp. I have most of it working now including the call back but am stuck on the last step.
Assuming it authenticates, I want to proxy pass directly to 127.0.0.1:3838/myapp.
In other words, if the loopback address were public I could do:
res.redirect('http://127.0.0.1:3838/myapp/');
However, as it's not public that is no longer an option. Any advice?
res.redirect('/myapp'):
Should redirect you to the /myapp route assuming that you are running the NodeJS app locally on 127.0.0.1:3838
Have a look at https://stackoverflow.com/a/44445540/16471349
I'm attempting to run the project located at https://github.com/docusign/eg-03-csharp-auth-code-grant-core. I've followed all of the prerequisite steps listed in their read me file, have a newly generated Integration Key and Secret Key, and when I build the project in visual studio it runs without errors.
The problem is, whenever I try to sample links it redirects me to a docusign authorization page and when I put in my credentials it just gives me the message "The redirect URI is not registered properly with DocuSign".
I've gone to the admin portion of my developer sandbox and added the URL my project is running on http://localhost:8080. I also added in a second URL for where the example code should bring me http://localhost:8080/dsReturn, but I keep getting the same issue and I'm having trouble finding help online.
Could anyone help me with this? What else do I need to change?
The project runs on the following URL/port:this is the port the base project runs on
If your application is running on http://localhost:8080, the Redirect URI you register in DocuSign should be http://localhost:8080/ds/callback.
Note that the redirect URI is a specific landing page within the project, not the base domain.
Make sure that the URLs are registered for the correct integration key (clientId) you may have a mismatch between the IK you use in your code and the one you used to configure the redirect URI.
It take 2-5 minutes for updates you make to be reflected, make sure to wait a few minutes and try again.
URL must match exactly, http or https doesn't match
Confirm your port #. 8080 is not usually what IIS express is using.
We have a site hosted on IIS using http (port 80)
and we have a new site hosted on Node using https (port 443)
For reasons I won't go into too much, we can't use IISNode to run all websites on IIS.
This setup works unless someone uses https to reach one of the IIS hosted websites.
to reproduce:
http://nameprintgraphics.com -> IIS website
https://npgcloud.com -> Node website
if you type in https://nameprintgraphics.com however, you go to the node website. I want to prevent this behaviour. Since node is listening to port 443, is there a way to validate the hostname and if it's incorrect, redirect the user to http.
I know this is a bit of a convoluted way to fix things, but please work with me to find an interim solution to this problem. IISNode is preventing a legacy silverlight app from working in IIS for reasons I have yet to determine.
Why not check req.headers.host in your node app and if it matches, then simply send a redirect response immediately? For example:
// You may/may not want to append the `req.url` to the destination as well
res.writeHead(302, { Location: 'http://nameprintgraphics.com' });
res.end();
I have a godaddy domain being redirected to an instance of EC2 with an elastic IP. on instance there runs my NodeJS on port 5000. i m redirecting 80 to 5000( till here everything works fine). In express i have a route say '/Calculate/:Type', which is visited when some caculate button is pressed. ideally the when button is pressed a request to server should go like http://example.com/calculate/3 but here is goes http://example.com//calculate/3 an extra / before caculate ruins the entire route. can someone please tell me why is it happening?
Modify the route where you define the findone query and remove the forward slash from it.
Try adding a period in front of /Calculate/:Type so
'./Calculate/:Type' in your express route
Ahh so it seems like you may be hitting a CORS error. Is your webserver and dataserver on the same url?
Best option : Put the node instance serving your app on yourdomain.com, and make your api endpoint api.yourdomain.com/Calculate/:Type
Other Option: exposing yourself to security risks by adding a 'Access-Control-Allow-Origin = *' in the header of your response
Other Option: expose yourself to security change your settings in htaccess to allow all, or the specific domain
We have a domain name with DNS management facility. We also have a web application developed in a GlassFish server hosted in a virtual server with a path is
http://198.98.103.233:8080/pemis/
I want to direct to the home page of that application when some one type the domain name. After navigating through the pages, we must be able to see
http://www.pemis.lk/faces/public.xhtml
in the browser rather than
http://198.98.103.233:8080/pemis/faces/public.xhtml
How can we configure that.
Thanks in advance.
You need to install your application as the root application in Glassfish, as explained here. But it's not hard:
asadmin deploy --contextroot "/" your-webapp.war
or set the context-root property in the sun-web.xml or glassfish-web.xml depending on the version of Glassfish you use.
To change the port Glassfish listens on you need to modify the HTTP Listener configuration. On default installations you'll want to change http-listener-1's port. You can do so using the console. But you can also directly edit the domain's domain.xml:
<network-listeners>
<network-listener port="80" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
...
</network-listeners>
Last, to make www.pemis.lk point to that server you need a DNS entry that points to the address the server is attached to. The details of how to do that depend on the comapny that sold you the domain, quite often they have online tools that allow you to enter or modify the name-address mapping. In case of doubt it's best to contact them by phone or mail.
I'm on the same path and, as you don't posted the solution that you found (if you found it), I'll add here some future reference for anyone facing this problem.
I'll break the question in two parts: Eliminating host:port and changing how the URL behave.
I don't have a complete response to the first, however if you chose to listen at port 80, by HTML standard, you will supress the port on the URL, getting half the solution you want.
The second part, changing the URL behavior and/or shortening it can be achieved by either using mod_rewrite in apache or Tuckey's URL Rewrite Filter (http://www.tuckey.org/urlrewrite/). A google search using URL Rewrite can achieve you a more in depth explanation and there's a guide on the website.
You should, however, update your question with an answer, if you found one.