Neep help in properly setting up load balancer and googl cloud cdn - google-app-engine

I tried to set up Google Cloud CDN for my server on Google Compute Engine. I have done everything correct but images on my server are not getting cached.
Cache hit ratio is n/a.
In logs, I am getting 200 status code for http://(ip address)/poweredby.png. So I am assuming frontend IP is not hitting my server but somewhere else. Other than this I can't find any error, all setup is correct. May be I have to change something in my nginx conf file? but I don't know. Let me know if question is not clear.
Update:
I was using http but someone suggested https is must. So, i have updated it to https but now health check is getting failed.
Thanks,

According to this documentation not all responses are cacheable. You need to meet all requirements for Cloud CDN to cache a response.
Regarding the HTTPS health checks: confirm that you have added 35.191.0.0/16 and 130.211.0.0/22 to your firewall rules. More information is in the documentation on GCP health checks.

Related

Google Appengine logging for golang

I keep seeing these errors in the stackdriver logs for a google appengine app written in go:
2017/11/05 23:30:38 internal.flushLog: Flush RPC: service bridge
returned HTTP 400 ("App Engine APIs over the Service Bridge are
disabled.\nIf they are required, enable them by setting the following
to your app.yaml:\n\nbeta_settings:\n enable_app_engine_apis:
true\n")
Does anyone know the proper way to resolve this? I looked in the docs and the enable_app_engine_apis beta setting has been deprecated. The app does work but this continually clutters the logs.
I had the same problem and I asked Google Cloud Support. They replied that there is no way to avoid outputting it to the error log, as it requires a fix on their end. They raised a github issue. Here is the link:
https://github.com/GoogleCloudPlatform/appengine-sidecars-docker/issues/82

App Engine + HTTPS + PageSpeed = 403 Forbidden Error

The application is on Google App Engine (Python 2.7, webapp2, HighReplication) working properly with HTTPS.
The HTTPS is configured in the app.yaml with the secure: always attribute, instead schemes=['https'] in routes.
so far everything OK, If I do a "curl -I HTTP://[MY_URL]" , the answer is:
HTTP/1.1 302 Found
Location: HTTPS://[MY_URL]
This 302 is OK, because means the resources has another location (with HTTPS)
But.... when I enable PageSpeed on "App Engine -> Application Settings", I have this error:
HTTP/1.1 403 Forbidden
I know what 403 error is, but why does it happens only when I enable PageSpeed and how can I fix it?
Thanks in advance
I assume you have not refered the FAQ of google please refer this link
this says you need to provide,
You sign up and provide us with your serving and origin servers.
You send traffic to PageSpeed Service by pointing your DNS CNAME entry to pagespeed.googlehosted.com.
Also Python needs to be configured for page speed, refer link PAGESPEED
and its still experimental
and refer this link
Find this point "Enabling PageSpeed Optimization Service"
this link says its paid service you need to pay per GB bandwidth, it optimizes your pages automatically!!!
I hope you will work around the problem after this reading links.
If you are not novice user, you do not required this if you are not adding any useless thing to your app's pages.

GAE: API serving not allowed for this application

I am attempting to follow the tutorial at: http://www.youtube.com/watch?v=v9TG7OzsZqQ
My Cloud Endpoint REST API works well on my local development machine, but when I deploy to App Engine, I receive errors in my Admin Log that "API serving not allowed for this application".
Is this a paid feature that I must enable billing to receive? If not, is there documentation that explains this issue and how to fix this error?
To use Endpoints in production you need to be accepted into the trusted tester program. You can apply here. Mention this Stack Overflow post in your request and I'll see if I can expedite approval.

CloudFlare with Google App Engine overquota

I've been looking at CloudFlare as a CDN service for my Google App Engine hosting, and as a student, cost is always an issue (aka free services only). I read on the CF blog that when the origin server is down, CF will serve a cached version of the website from its own servers to users.
So if we hit the GAE quota limit, is the server considered as "down"? Will CF display the cached website? I don't plan to have a lot of dynamic content so serving an entire cached website is not too much of an issue to me.
If the answer to my first question is no, is it possible to get CF to serve it's cached website content automatically once GAE hits any quota limit? I know it's probably unlikely but just wanted to throw this question out.
According to CloudFlare's wiki, the Always Online feature will return a cached page only if the backend server is unavailable or returns a response code of 502 or 504. When you hit quota limits App Engine itself will generally still be available, so whether the cache works depends on the response code in your case.
If your app exceeds its bandwidth or instance hour quota, App Engine will return a 403 Forbidden response code. It is possible to customize the content of the error response, but not the code. It seems then that CloudFlare will not serve a cached page in this case.
However, if your app hits an API usage quota, your code will receive an exception and you can choose to return one of those 50x codes and trigger the cache.
I'm not sure if this particular case will work for CloudFlare because of the error code that App Engine returns (we are working on some enhancements for Always Online, but it really won't tackle 403 errors).
It does appear that AppEngine does allow you some customization of the error pages?
Tip: You can configure your application to serve a custom error page when your application exceeds a quota. For details, see Custom Error Responses documentation for Python and Java.

urlfetch.fetch() from Google App Engine not showing up in Fiddler2

I'm testing a Google App Engine app on my Windows machine, running locally on localhost:8084. Fiddler2 shows all my activity when I navigate around my app, but when requesting an external url with urlfetch.fetch() it doesn't show up in Fiddler at all, even when using an http, not an https address, and with a successful status code 200 in the response.
What do I need to do to get the urlfetch.fetch() request from Google App Engine to show up in Fiddler2?
My understanding is that Fiddler2 runs as an HTTP proxy; browser requests go through this proxy instead of directly to the internet resource. This allows Fiddler2 to capture information about the request and the response.
According to the Fiddler2 docs, "You can configure any application which accepts a HTTP Proxy to run through Fiddler so you can debug its traffic". So I think you would need to change the URLFetch API call to use a proxy, supplying the Fiddler URL and port. However, the URLFetch documentation doesn't specify exactly how to do this. You might be able to use urllib2 as specified in this question.
Irussell is generally right, but I'd like to make the answer more specific.
As proxies aren’t supported within Google AppEngine production environment, it’s not directly supported by development engine either. It seems that the only way to overcome this limitation is to modify the code of AppEngine development server.
You'll have to modify the urlfetch_stub.py file, by adding the following lines:
connection = connection_class('127.0.0.1', 8888)
and
full_path = protocol + "://" + host + full_path
You may find the detailed explanation in my blog post Use Fiddler to debug urlfetch requests in Google AppEngine

Categories

Resources