deployed appengine cloud endpoints 403 - google-app-engine

My deployed site cant reference endpoints. It works perfectly locally but remotely I get a 403 in the client:
GET http://mailmanagerplus.appspot.com/_ah/api/discovery/v1/apis/agreement/v1/rpc?fields=methods%2F*%2Fid&pp=0 403 (Forbidden) rs=AItRSTOc4KBtnc5SIOEaPiMWPOclVYHqsA:153
All seems to have deployed successfully looking at the logs. I currently don't use any authentication.
Any direction would be useful as I'm very new to this.

you have to switch to "https" protocol if you want to use endpoints client library on the production.

Related

How to serve HTTPS data on an AWS elastic beanstalk instance

I have an elastic beanstalk instance in which I have deployed my spring-boot application. By default elastic beanstalk gives you a URL for your environment over http.
While this works fine this has led to a lot of problems for me. I have the frontend (my react application) deployed on Vercel. I want my frontend app to get data from my elastic beanstalk app. Problem is the url is in http. On the console I get an error like this
Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure resource ''. This request has been blocked; the content must be served over HTTPS.
which renders the app useless basically.
After hours of google I found out that I have to request the data over https because my vercel app is over https*(I might be very wrong here)* I've tried some solutions to get my elastic beanstalk app to serve the data on https to no avail.
Here is what I've tried
I created a self signed ssl certificate using openssl and uploaded
it to AWS via the AWS cli. I then went to my applications load
balancer settings and added the ssl certificate . (This did not
work, I cried)
I used keytool to create yet another ssl certificate and added it to my
resources folder and the corresponding settings in the
application.settings file. I repackaged the jar file and redeployed
it to AWS.(Still didn't work. Didn't cry this time though. I was
out of tears)
Question How do I serve the data from my spring-boot app to my Vercel react app over https? Or any other method. Just anything that will work.
If one thing is clear from all that long nonsense I've told you up there is I don't know wtf I'm doing. Just following a bunch of tutorials which for all I know keep destroying my app and your time even more.
Now my app is broken and now I cant even load the static assets on the elastic beanstalk URL because I'm getting another error
400 Bad Request
The plain HTTP request was sent to HTTPS port
I know that question is really long and maybe even wrong. Please help
So once you have the SSL certificate ready this what you need to do in the AWS Elastic beanstalk to serve your application for https
Add a new listener to for port: 443 and select HTTPS
After this incase you are facing any certificate error while browsing the page, ensure that the URL mentioned in the certificate is matching the URL in browser

Error during WebSocket handshake: Unexpected response code: 400 when deployed on google cloud

I have made an app of Django Channels and its working perfect locally,but when I deployed it to production (Google Cloud Platform) it's giving me:
(index):42 WebSocket connection to 'wss://appname-263701.appspot.com/ws/chat/user2/' failed: Error during WebSocket handshake: Unexpected response code: 400
I can't figure whats the problem is, is it a problem of WSS? The app is working fine locally.
If need some code to review I can also upload that! Just need a guide how I can fix this
I think you are using Standard App Engine Environment, and WebSockets are only supported in the Flexible Environment for App Engine. So, I would suggest you to change the environment from Standard to Flexible, see here for the app.yaml Configuration File in Flex. This way, you will be able to use WebSockets functionality implemented on App Engine.

Google Cloud Platform random 404 on endpoints

I have two apps deployed on google cloud. One exposes an api, that is consumed by the other.
But, sometimes, some of the request return a 404 http code. I cannot find a pattern to reproduce it yet. Any idea?
404 Cannot POST {link-to-api}

https on google cloud works intermittently

Im using HTTPS provided by Google Cloud with an App Engine project.
And https://example.com works intermittently.
Many a times I see the error unable to connect.
But https://example.appspot.com will be working.
How to resolve this ?

Running Endpoint locally could not provide access to API explorer when HTTP proxy is enabled

I'm using Android Studio(0.5.8) on Window7 x64 for developing my Android App with Google AppEngine backend.
If my machine is having direct internet access and I launch backend locally (as DevApp Server) and access my API Endpoints through webbrowser (chrome) it is all working as expected.
Accessing api explorer is also working fine from webbrowser.
http://localhost:8080/_ah/api/explorer
But if I have configured internet through http proxy (in Android Studio and also in webbrowser) then webbrowser displays initial page of backend but can't access endpoint api explorer.
And deploying appbackend in Google AppEngine also fails with errors.
gradlew backend:appengineUpdate
Same is working fine if direct internet access is available (not via http proxy).
How can we make it work with http proxy also? Any help is appreciated, Thanks.
You should be able to tell any command that wraps appcfg (appengineUpdate is one of them) what the http/https proxy is.
In your build.gradle file add to the configuration (more info at https://github.com/GoogleCloudPlatform/gradle-appengine-plugin)
appengine {
httpProxy = "some proxy"
}
I'm not sure about the api explorer though.

Resources