Squid reverse-proxy for site on Google AppEngine [closed] - google-app-engine

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm setting up a squid 3.1 reverse proxy server (accelerator) for my website on Google AppEngine. The squid.conf looks like this,
http_port 80 accel defaultsite=my.public.domain.name ignore-cc
cache_peer mysite.appspot.com parent 80 0 no-query originserver login=PASS name=gaeAccel
acl gae dstdomain my.public.domain.name
http_access allow gae
http_access deny all
cache_peer_access gaeAccel allow gae
cache_peer_access gaeAccel deny all
Squid redirects me to the Google's search home page.
As soon as I changed mysite.appspot.com in cache_peer to anything else, such as www.yahoo.com, it worked.
Any idea?
It's on Ubuntu Server 12.04, Squid 3.1.
Thanks in advance,
Will

If you only want to bypass GFW, use Cloudflare.

Using your own proxy server makes it a single point of failure, effectively defeating one of main purposes of GAE - reliability.
App Engine already has their own transparent caching servers:
For static content you can set this explicitly via expiration attribute.
For dynamic content you can set Cache-Control http header, which Google transparent cache will then honor: http://davepeck.org/2011/10/25/a-word-on-app-engine-caching/
Note: you still pay for the bandwidth at $0.12/Gb. But OTOH, you proxy and it's traffic are free neither.

Related

Record discord bot uptime with uptimerobot.com [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm making a statuspage(statuspage.io) for my discord bot, and I want to record the downtime automatically with uptimerobot.
But I have no idea how. Does a discord bot (written in python) use a specific port, which can be used to see if the bot is online?
Or do I need to do this somehow with the discord API to check if the bot is online?
I haven't found anything, except something with a discord bot hosted on glitch, but I don't host anything on that site, I host it myself.
Also how do I connect uptimerobot with statuspage?
For uptime robot to work, you need a publicly facing webpage that it can request every 5 minutes.
Two options:
Your discord bot needs to run in the cloud and run a http server at the same time
Have your web server accept another request like example.com/keepalive to tell the server that the bot is still running.
Uptime robot would then query example.com/alive and you have to return 200 OK if the bot is online and 404 if offline.
NOTE: If you already have something like the 2nd approach running, you may as well just save the uptime info on your public server. I also recommend passing some authentication in headers or as a query (password, for example) if you use this to avoid people abusing it.

400 Bad Request Request Header Or Cookie Too Large nginx

How should i solve this error on Real NGINX Server? When i was developing on local there was no error show with that. And it's only happen on Mobile and Tablet. Not happened on PC Browser. I searched in google and stackoverflow too but the problem solving is only one way. I've to give my project manager to different solving methods at least 2 - 3 methods. Because Server providers won't allow to config the NGINX config file so we can't use this method. Currently I found below method. Is there any other method to solve this error like adding some codes or something that we can use without server providers?
server {
# ...
large_client_header_buffers 4 32k;
# ...
}
Developing Platforms : NGINX, Cakephp 3.x

Facebook Messenger - postback outages? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have been successfully developing Facebook Messenger bots for the past couple months and lately have been experiencing an issue where 'postbacks' are sometimes not sent to my server, even though plain typed messages are sent immediately and of course web hooks validate fine.
Sometimes with enough teardown/subscribing of web hooks and pages the postbacks work again but I can't always get it to work again. I have multiple bots and multiple pages running not sure if that is related.
Also, yes I'm currently subscribed to receive postbacks.
Has anyone else experienced this? Thank you
It may have been resolved by now, but i was finally able to figure out when does postback work, and when it does not.
As per my observation, and many tests I came to conclusion, that facebook uses the same access token to "postback" which is used to create the persistant menu, generic template button, or a button template.
If the page Id, or the APP id (which is more probable, as people have a prod and test app for the same bot) differs, the postbacks are not sent back to webhook even though the webhook has the "messaging_postbacks" subscribed.
In my case it turned out the the page access token was generated with the production APP id, and i was testing in my test app, which had different app iD. Also, my persistent menu also worked when generated thru a test app access_token.
As a best practice, i hard code the access token (safer as well, as the generated access_tokens expires in some time) if the environment is not prod, and use the logic to generate the token when the app is live.
Update:
So it turns out after 44 hours of firefighting, the problem auto-corrected itself. Facebook team replied that all they have is a 502 error. and that too resolved automatically. I have contacted my domain provider and AWS and they said that that the issue is not at their end.
My conclusion, something must be happening in facebook's infrastructure as the same domain cannot have partial 502 errors (meaning for one use case it happens and other it doesn't when the webhook url is same). Hopefully, they figure it out even though they don't tell us.
So I don't have any reputation points for commenting so I am posting as an answer. I am facing a similar issue, the only difference is we are getting a quick response in postbacks but not messages.
We are consistently facing a problem of irregular incoming messages on our server for messenger bot. Our observation is that we receive a payload only after a few (random) seconds after the message has been typed (and sent) by the user. However, facebook instantaneously sends us the necessary payload if a buttontap is performed.
We have established that the apache server is not receiving any request (during that time). We have also established that our SSL certificate is not expired. Moreover, we have all the necessary ports open on our AWS instance (mainly 443 and 80).
Any clues anyone? we are facing this issue for last 21-22 hours.
I got the same problem yesterday, while developing the second facebook messenger bot (for the second Page). The postback wont come after some hours, that's what ridiculous (as I expected, the messages shouldn't come!!!).
The reason was the Page Access Token for the second Page was wrong! You have to pick the right Token from the right App. Because it's possible to generate the Page Access Token for the second Page from the first App.
While subscribing to webhook select messaging_postbacks checkbox.

Best implementation (folder structure) of SPA with Yii2 and AngularJS 2 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
As you know angular 2 is in beta right now.
Generally is it good to start a single page application (SPA) using angular 2 and yii2 as a RESTful API (for backend services)?
Assuming this:
how could be the structure?
What is the best implementation of this? (with sample)
Update:
Sorry, but I'm not good in English. I think the usage of implementation was wrong. I mean what is the best folder structure for using yii2 and angular 2 as a SPA like this repo.
Last Update:
As #SalemOuerdani told and mentioned I think that this link is my answer. maybe my question is a duplicate! Sorry for that!
The Yii2 quick start example for REST gave those endpoints as example:
GET /users: list all users page by page;
HEAD /users: show the overview information of user listing;
POST /users: create a new user;
GET /users/123: return the details of the user 123;
HEAD /users/123: show the overview information of user 123;
PATCH /users/123 and PUT /users/123: update the user 123;
DELETE /users/123: delete the user 123;
OPTIONS /users: show the supported verbs regarding endpoint /users;
OPTIONS /users/123: show the supported verbs regarding endpoint /users/123
Well that is REST. It doesn't matter which tool or framework to use. You can rebuild the same using Ruby, C or NodeJS and steal being the same app. Just have it in seperate folder or server and call it backend or server while it retreives data from DB or whatever else to answer the previous URI's.
The frontend in this case is the other app built with whatever language stored in a different folder or server that when it does a request to GET /users will expect a json response. when it does some edits on user 123 and send it back to server within PUT /users/123 it will expect the server to responde with a 200 response to know that it has been saved to database or a 422 error for example if validation fails.
My advice is to work with both tools as separate things. I don't recommand changing Yii's default rooting. The commun point between both should be the standards and concepts or architecture you did decide to implement or design for your HTTP requests.
More answers and a valid structure for Yii and angular may be found in the following:
What exactly is RESTful programming?
Yii2 + AngularJS in a single application - how?
How could be the structure?
There are alot of github repo's available for the best structure of angular2. you could refer to those for structure of your app,
this one is good repo i had ever found here:-
https://github.com/mgechev/angular2-seed
here is my repo you can refer to this too...
https://github.com/MrPardeep/Angular2-DatePicker
What is the best implementation of this? (with sample)
For implementation there are alot of tutorials and articals are there on the internet, but i personaly suggest to refer from the
official website of angular first.
https://angular.io/guide/quickstart
http://angularjs.blogspot.in/2015/12/angular-2-beta.html
http://www.angular2.com/

Silverlight web service query [duplicate]

This question already has answers here:
Silverlight Crossdomain
(13 answers)
Closed 10 years ago.
This error shows me in silverlight page
An error occurred while trying to make a request to URI (/HML.asmx).This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent.This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
1> Have you looked at the inner Exception? What does it tell you?
2> You should understand what is cross domain access and how cross domain policy could allow it: https://support.ookla.com/entries/21097566-what-is-crossdomain-xml-and-why-do-i-need-it (it is about flash, but it is true for silverlight as well)
Anyway, be more precise about what you try to do? Access an external web service? Call an https part of your website from an http part? This error could occur in a lots of case.

Resources