No router instances found error message, right after creating NextJs app - next.js

I am new to Next JS, I'm experiencing this error right after I created my first app and run it from the terminal. I haven't declared next/router in vs code, did not change or add files to my project.
I tried to restart the server, but the error message remains.
Error: No router instance found.
You should only use "next/router" on the client-side of your app.

This error is due to your Reactjs web application URL & your API URL are not having same origins (not running on same port or same hosts or same schemes).
Two URLs have the same origin if they have identical schemes, hosts, and ports.
EX: Your web application URL http://192.168.3.143:4040 is different from your React web application URL.
Therefore you need to try any of the following solutions:
Your web application & API application should have the same schemes, hosts, and ports
OR
You need to enable CORS in your API, for your web URL which is different than your API URL.

Related

ASP.NET capture DNS from HttpReuest.CurentContext with https

I am working in one of the applications running on .NET Framework 4.6.1, where I am trying to get dns name (on server) and on local, both having 'https' protocols.
Locally I am accessing my application with https://localost:44301/ however request object is showing me http://127.0.0.1
On Server I am accessing with https://dns.com/ however logs are showing me http://127.0.0.1 - running instances behind ALB.
Code:
var host = System.Web.HttpContext.Current.Request.Url;
I am calling this on Startup.cs class.
I see my browser has and showing https://localhost:44301, however code is showing http://127.0.0.1 as mentioned above.
My code is running on .NET Framework 4.6.1 and unable to find anything more with HttpRequest object.
Question - How can I get correct DNS name or localhost:44301 from request object or using some other mechanism.

how to fix the path for my request to a go server from a polymer app?

I am working on a GO/Polymer app (Polymer as frontEnd and go as Backend) the server is done with go and functioning and the app with polymer and it is working aswell.
The problem i have is when i try to run the app on localhost my requests are sent to the wrong socket so the server never gets them therefore i cannot test anything nor modify the existing app.
I'm trying to run the app that has already been built by others and add new features but i am a beginner with polymer.
I tried to modify the URL given in the requests... without any success...
the server :
router.PathPrefix("/polymer/").Handler(http.StripPrefix("/polymer/", http.FileServer(http.Dir("/polymer/build/es6-bundled/"))))
log.Fatal(http.ListenAndServe(":8080", router))
The directories are set up this way :
C://Users/go/Myapp/
in this you will find a server directory with all .go files
and a polymer directory with the files related to polymer and the frontend.
So when i run the server and build/serve the polymer app i get the following link : http://127.0.0.1:8081
when i try to use a query (e.g connecting to the app with credentials stored in a mongoDB database.) it sends the following link http://127.0.0.1/8081/login/?password=xxxx&username=xxxxx
So it never reaches the server which is listening to the socket 8080.
When i change the request link to http://127.0.0.1:8080/login/?password=xxxx&username=xxxxx i get the response from the server.
So i know where the problem is but i dont know how to fix it to run my app on the localhost...
Thank you for helping ! If you need anymore resources i can provide.

Pivotal Cloud foundry - Spring Boot Actuator not working with Pivotal Apps Manager

I'm currently deploying a spring boot 1.5.1 application to pivotal cloud foundry. The Apps manager is displaying the Spring icon but i cant configure the log level or see any of the settings. I'm getting a browser 'mix content exception'. Apps manager is trying to access /cloudfoundryapplication/info over http instead of https and the browser is blocking the request. Is there a setting to force Apps manager to only use https?
Our team encountered a similar issue. We feel it has nothing to do with the apps manager but rather as to how our app behaves.
In our case we had a bad configuration which was causing the URLS getting built as http when httpRequest.getScheme() was being called.
server.tomcat.internal-proxies: <ips other then your proxy>
Correcting this property in our case by letting it to default as defined here let the getScheme to be returned as https and there by when the call being made to /cloudfoundryapplication/info the scheme got built as https.
Also another suggestion made by one of our colleague which also resolves this issue but would not address the root cause is - fronting your application(highest precedence) with ForwardedHeaderFilter - this causes the X-FORWARDED-* headers to be available in your httpServletResquest as described here

Web Api Route Attributes not matching on remote server

We have an API, routed with Attributes, and registered first in our start up method with config.MapHttpAttributeRoutes();
This works fine locally.
However on the test environment the Api routes are not matching a request, and instead are tried to be matched via the default MVC router. The default MVC route is registered at the end of our start up method.
I've triple checked the config transforms, even the deployed web.config to ensure there are no url rewrites getting in the way.
The requests are simple JSON requests.
Anyone have any pointers as to anything else that could cause the Api routes to be ignored on remote environments only?
Thanks
Turns out it was due to old libraries in the bin folder on the remote server.
The lesson here is to make sure deleted files are also deleted in the build process, or to manually delete them.

signalR Cross Domain with tcp protocol used as selfhosted server

I am trying to implement the Cross-domain calls with SignalR File version 1.1.20525.0 . I have my views in (localhost:1598) and the 'service' in (localhost:8040).
But i am getting this error "XMLHttpRequest cannot load net.tcp://localhost:8040/signalr/negotiate?_=1375725058645. Cross origin requests are only supported for HTTP. " .Where am i doing it wrong or what should i add in my project?
My hub is in the same project where my views are so should i move them to service project folder?

Resources