AWS APi Gateway getting response message as ": "Endpoint request timed out" 504 from AWS Service - server-sent-events

I have deployed Spring boot Java server sent event application in AWS Service.
My Html eventsource index.html trying to access using AWS API gateway end point url(where I configured Java server sent event application rest api url).
The Following things are observed ans wroking:
1. I able to connect to Back End AWS server.
2. Event source URL register its request in Java Serve sent event application
3. But response is not getting from AWS serve to APi GAteway.getting timeout
error after 30 seconds.
Kindly Help me on to fix this issue

Related

How to call an ASP.NET endpoint locally but from another device on the same network? The certificate for this server is invalid

I have an ASP.NET API running locally. On the MacBook Pro, I can access the endpoints with Swagger, Postman and in the frontend (running on LiveServer) using Axios/JavaScript.
I have successfully loaded the frontend webpage on an iPhone (192.168.0.10:5500/index.html), however the Axios call to the endpoint is failing with the following error message logged to the console Failed to load resource: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.0.10”, which could put your confidential information at risk.
Running the command dotnet dev-certs https --trust generates the message Successfully trusted the existing HTTPS certificate. but does not resolve the issue.
Am I missing something?
#Lex Li's comment worked.
Steps
Remove or comment out app.UseHttpsRedirection(); in program.cs file.
In the launchSettings.json file, "applicationUrl": "https://localhost:7139;http://localhost:5171", generates a http and https url for the API endpoints. Edit the http route to the IP of the computer/local server, e.g., "applicationUrl": "https://localhost:7139;http://192.168.0.10:5171"
use the http endpoint

How to call http://metadata.ggogle.internal from within web app loaded over https

I have an Angular web app running on Cloud Run (nginx webserver) (more info here) from which I want to get access token from the GCP metadata server. I have tried to make a call to https://metadata.google.internal ( using curl from Cloud Shell) but the connection was rejected. Calls to HTTP are working well.
When I make the call from my app (which is loaded over https) to the metadata server over HTTP - logically I get a mixed content error. When trying to access the metadata server over HTTPS - I am getting error 504 Gateway timeout, I assume due to the reason that the metadata server refuses the calls on HTTPS.
I will really appreciate any idea of how to solve this issue.
The URL endpoint metadata.google.internal is only accessible from inside the instance (Cloud Run). This endpoint is not accessible outside of the instance such as via an HTTP or HTTPS call. A clue is the TLD (Top Level Domain) internal.
If you want to access this endpoint remotely via a web browser, you will need to make a request from the browser to Cloud Run (an endpoint in your code) which then makes the internal request to the metadata server and returns the response to the client.

How to resolve HTTP 405 error NotAllowedMethod

I created .Net Core Rest API service with two GET method. Locally in debug mode, everything works as expected. When I deploy this service on Azure Kubernetes service and behind API Management, on every call to these two GET method I receive HTTP 405 error. I tried with different endpoints, but any of cases didn't resolve this issue. Any idea?

Strange request URLs when running ASP.Net Core Application on Amazon Elastic Beanstalk

I have a simple MVC ASP.Net application with a health check. The check is routed using an attribute: [HttpGet("health")]
When running it locally, I browse http://localhost:7000/health and get a successful result back. The logs look like this:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[00:00:34.796]: Request starting HTTP/1.1 GET http://localhost:7000/health
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: [00:00:34.796]: Request starting HTTP/1.1 GET http://localhost:7000/health
dbug: Microsoft.AspNetCore.Routing.Tree.TreeRouter[1]
Request successfully matched the route with name '(null)' and template 'health'.
However, once I deploy to Amazon Elastic Beanstalk, none of my normal request work. If I browse http://(myAppName).us-east-2.elasticbeanstalk.com/ these are the logs I get:
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[23:56:39.079]: Request starting HTTP/1.1 GET http://172.31.27.29//(myAppName).us-east-2.elasticbeanstalk.com/health
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Builder.RouterMiddleware[1]
Request did not match any routes.
Note how for some reason the request URL gets an IP address stuck in there. No idea where its coming from.
Turns out this was a misconfiguration in AWS. I had set the health check URL with an absolute address, which failed. Then when I tried to health check manually, the load balancer didn't let me through because the AWS health check was failing.
I thought the logs were from my manual check, so I assumed that amazon was adding weird things to my request. But really it was just a misconfigured health check in AWS.

When service through external host name returns wsdl html instead of the expected response envelope

I have an IIS-hosted, WCF web service deployed on a UAT web server. In IIS, I have site bindings on this same web service--one for internal access (Ex: uat-nodotsinternalonly) and one for external access (Ex: mysvc.uat.mydomain.com).
When I use SoapUI to test against the internal host name (http://uat-nodotsinternalonly/MyService.svc), it calls the service and returns the response envelope as expected.
When I use SoapUI to test against the external host name (https://mysvc.uat.mydomain.com/MyService.svc), it calls the service and returns the WSDL HTML as would be seen in the web browser instead of the response envelope as expected.
We need to expose past our firewall for testing with a vendor. Our external client can browse to our web service using the external host name and receive the WSDL back in their web browser, but when they call it, it fails with a 302 error.
I’m far from an expert on security, but I believe our firewall is handling the security then forwarding over http to the UAT server. The redirect and variations seem as though there’s something to change in how DNS is managed or settings in IIS. Does anyone have suggestions as to how to narrow it down so that the call to the external service will work?
We too had a WCF service that in SoapUI was returning the WSDL HTML instead of the expected response when invoking a method. This was an SSL-enabled service, and the solution in our case was to edit the endpoint URL after creating the request so that it used https instead of http. This is because we found that for some reason it defaults to http even when you initially specify https when creating the request. Here's how to edit the endpoint URL in SoapUI:
In the request window, click the drop-down arrow on the URL.
Select [edit current..]
Change http to https, and then try your request again.
The problem with the client getting a 302 error was because the client was not sending a SOAP request envelope to our web service. The client was just sending XML.

Resources