I have an angular API on the front end which calls the backend C# both hosted on Azure,
The site can be viewd on PC browser, but when I try to navigate to the site from my phone, I get a "The request could not be understood by the server due to malformed syntax." from Azure's stream
I am using
import { HttpClient } from '#angular/common/http';
to call the back end
Looks like when i was trying to browse the website on the phone it did it using "http://" but once i changed it to "https://" it started working
Related
enter image description hereenter image description hereenter image description here
Assalamu ‘Alaykum
my React app is running on localhost:3000
NodeJS server is running on localhost:1000
I'm sending request to server 'localhost:1000' and everything is fine, correct response is coming from server, there is no error in Console, but in Chrome Network request-url is to localhost:3000/.../...
if I sent wrong data to server, it's coming correct error and bad request error in Console
can someone help me,
thanks
It sounds like your React app is making requests to the wrong URL. Based on the information you provided, it appears that your React app is running on localhost:3000 and your Node.js server is running on localhost:1000, but your requests are being sent to localhost:3000.
To fix this issue, you will need to update your React app to send requests to the correct URL, which should be http://localhost:1000/auth/sign/in. This can typically be done by updating the base URL or endpoint for your API requests in your React app.
For example, if you are using the fetch API to make requests in your React app, you can update the base URL for your requests by setting the baseURL property in your fetch options:
fetch('/auth/sign/in', {
baseURL: 'http://localhost:1000',
// Other fetch options
})
Or, if you are using a library such as Axios to make requests in your React app, you can update the base URL for your requests by setting the baseURL property in the Axios configuration:
import axios from 'axios';
axios.defaults.baseURL = 'http://localhost:1000';
After updating the base URL for your API requests, your React app should send requests to the correct URL, http://localhost:1000/auth/sign/in, and you should no longer see requests being sent to localhost:3000 in the Chrome Network tab.
It's worth noting that the exact solution for updating the base URL for your API requests will depend on the specific details of your React app and how you are making requests to your server. If you are having trouble updating the base URL, you may want to consult the documentation for the specific library or API you are using.
I created a webpage with flutter and deployed. I open in a browser using https and got a error message:
Do you have any idea what would be the best approach to solve this issue in general? I mean I have public frontend which communicate with insecure http backend api services. Should I use SSL connection for backend communications? Or should choose different flutter component?
My flutter code:
final response =
await http.get(Uri.parse('http://192.168.0.77:4010/status-board/'));
I have an angular universal app set up. I do POST requests on the server-side using localhost to pre-render my app and this works fine.
An example working url would be http://localhost:8000/api/get-info.
I've now put the app into production on an external url (apache server). I'm also using ssl.
Now when I try to do a POST request on the server-side to pre-render my app, I get back a response with status: 0, url: null (I'm assuming this means the connection was refused).
An example non-working url would be https://mywebsite.com/api/get-info.
What really stumps me is that when the app loads on the client, all HTTPS requests start working. So the problem is I cannot get the express server to send POST requests to my external url.
I've tested a post request on the server-side to a different website (twitter), and that seems to work fine as well. So i'm not entirely sure where I've gone wrong.
I already have CORS set to '*' as well.
Try using
http://localhost:8000/api/get-info
in production as well. Since your Angular app is rendered on the same server as your API is running, using localhost should just work fine. It doesn't matter if you are on an external URL.
I do something similar (its a GET but that shouldn't matter) with my translations:
if ( this.isServer ) {
translateLoader.setUrl( 'http://localhost:4000/assets/localization/' );
} else {
translateLoader.setUrl( 'assets/localization/' );
}
It works locally and in production (both server and client).
I just encountered this problem myself for two days. Please take a look at my comment on https://github.com/angular/universal/issues/856#issuecomment-426254727.
Basically what I did was I did a conditional check in Angular to see if the APP is running in browser or in server (rendered by Angular Universal), and change my API endpoint to actual IP in https or localhost in http accordingly. Also in my Nginx setting, I only redirect incoming request from browser to https by checking if the server_name is localhost.
Hope it helps!
I'm trying to send information to a Google Web Script (specifically, send a JSON object containing info to write to a Google Sheet) but I'm having trouble sending GET and POST requests to my Google Script.
I'm using Node.js and the "request" module to send the requests, but I don't receive what my doGet() and doPost() functions are supposed to return, instead I receive very long HTML files that are unrelated, some of which indicate a 404 error.
As an example:
Node.js
var request = require('request');
request("https://script.google.com/macros/s/my-web-script/exec", function (error, response, body) {
console.log(body);
});
Google Web Script:
function doGet(){
textOutput = ContentService.createTextOutput("Hello World! Welcome to the
web app.")
return textOutput
}
I published the web script and made it accessible to anyone. I'm not sure why this isn't working.
I think that both your scripts work fine. So can you confirm the situation of deployed Web Apps, again? When you modify your script, Web Apps has to be redeployed as a new version.
How to deploy Web Apps is as follows.
On the Script Editor
Publish
Deploy as Web App
Create new Project version
At Execute the app as, select "your account"
At Who has access to the app, select "Anyone, even anonymous"
Click "Deploy"
Copy "Current web app URL"
Click "OK"
The Current web app URL is https://script.google.com/macros/s/my-web-script/exec in your script.
The detail information is here.
If I misunderstand your question, I'm sorry.
I am using node as backend with ionic and integrated payment gateway.
Steps i followed : -
Sent post request to payment gateway with desired parameters.
Received post request to my server after successful transaction.
Now redirected flow from server to ionic app with localhost:8100
Here is something, i have been stuck up. How to redirect the flow from server to ionic app after publishing because here i don't know what URL i need to use to open the desired page of my app in mobile device.
In your node server you can redirect to specified URI like this:
response.writeHead(303, {
'Location': 'path.html'
});
response.end();
source
After looking a lot of resources, I found a plugin named 'custom-Url-scheme' that helped me to resolve this issue.
Here is the git repository - https://github.com/EddyVerbruggen/Custom-URL-scheme