Non-Latin characters in URL (Google App Engine) - google-app-engine

In my project I have html file with non-Latin characters: Кондиционер.html. When i make request:
www.myDomain.com/Кондиционер.html
Server sends 404 error:
Error: Not Found
The requested URL /%D0%9A%D0%BE%D0%BD%D0%B4%D0%B8%D1%86%D0%B8%D0%BE%D0%BD%D0%B5%D1%80.html was not found on this server.
But with Latin latters everything works fine.
What can I do to set GAE server to support such non-Latin file names?

Try this (does not work on the web-console, but in real *.py files):
print urllib.unquote("Ober%C3%B6sterreich.txt").decode("utf8")
For static files you need a redirecting request handler and an ascii-named file to which you redirect.

Related

condenameOne 404 Not found

IDE: NetBeans/
OS
Simulator
My Wampserver is running in port 8080,
I create a text file under www directory, the URL that I am using is :
http://localhost:8080/codenameone/tst.txt
and when I run the code it returns
Error 404: Not found.
I just did that and checked the URL multiple times already, even when I copy the URL in the URL bar it works but when i run the code with codenameOne no.

How to deal with callbacks having dot in the URL with built-in PHP server?

I am using Drupal site (with .htaccess and clean URLs which are working fine) within built-in PHP Development Server (run by: php -S localhost:8888) where in CMS I generate dynamically the XML file which I would like to expose, however when I am trying to open /foo/bar.xml the following error happens:
The requested resource /foo/bar.xml was not found on this server.
After investigation, it seems PHP built-in server assumes that all files containing a dot they must be the files in the local filesystem.
Is there any workaround for that?
According to PHP Built-in web server docs, to handle custom requests, you need to specify a "router" script (given on the command line) which returns FALSE, then the requested resource is returned as-is, otherwise the script's output is returned to the browser.
Using a Router Script
Here is simple example which handles requests for images, then display them, otherwise if HTML files are requested, it will display "Welcome to PHP":
<?php
// router.php
if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
return false; // serve the requested resource as-is.
} else {
echo "<p>Welcome to PHP</p>";
}
?>
Drupal 7 & 8
For Drupal 7 & 8, you can use .ht.router.php file, then run it as:
php -S localhost:8888 .ht.router.php

CakePHP Routing Slugs, detect Extension?

In my 2.X app we're detecting which Tenant is using the system via a Slug in the URL, ie:
app/[tenant_slug]/[controller]/[action]
The issue however is that when the users browser requests for some static file our server doesn't have, such as:
app/apple-touch-icon-76x76.png
Cake takes 'apple-touch-icon-76x76' as the tenant_slug - so then our server has to determine that no, it doesn't have that slug and then throw back a Not Found error.
I have the following matching criteria on the route:
$validTenant = '[a-zA-Z0-9-_]+';
And I also have the following enabled:
CakePlugin::routes();
What is the correct way of handling this so the router knows that if a static resource is requested (ie: file ending in .js, .css, .png etc), it shouldn't use the file name as a slug? Or, should I have my code that looks up the tenant_slug (TenantAuthorizeComponent) handling the case where there is a file extension?
I would handle this at the webserver level, if possible, do not even let php slow down your static files requests - for example for nginx I pass just php files into the interpreter using this statement in mysite.vhost.conf:
location ~ \.php$ {
fastcgi_pass php;
}

App engine: Static files with special characters causes 404 file not found

As the tite says; I'm having problem accessing static files with special character in them.
I have the following folder structure: "war/public/mystuff/images/my_weird_åäö_chars.png", but when I try to access the image with special character in it I get response 404. Any other file not containing special character works.
On the Dev-server everything works fine, but on the Production-server it can't find the files. Even if I escape the characters in the url they can't be found for some reason.
Is there any setting in the web.xml that I should make so that it allows UTF-8 characters in the filename? Or any other settings?
It's might be worth mentioning that I probably can't change how I access these files (meaning I can't for example url-escape the path before I retrieve the file), the page is created using Construct 2 which builds the "app" to HTML5.
Thanks!
I'm afraid you're out of luck. I'm having the same issue with special characters (~ in this instance). And when running mvn appengine:update the log spits out:
Aug 13, 2015 3:56:15 PM com.google.appengine.tools.admin.AppVersionUpload addFile
SEVERE: Invalid character in filename: __static__/img/0~452203~200~150~2
It seems that you cannot upload static files with none-ascii characters so the 404 is really a 404 (the file is not sent to GAE)
There is a bug-tracking thread here, but seems no progress has been made:
https://code.google.com/p/googleappengine/issues/detail?id=2211
I've looked around but found no workaround other than to rename your files

Passbook pkpass files are not detected

I have book my itinerary and the travel website delivered the ticket along with the pkpassfiles. Unfortunately neither Safari nor Chrome detects it and show the option to open in passbook application. It shows options like FileApp/CHM reader etc. How to solve this?
I use default Gmail iOS App/Safari for opening opening mails (It's a gmail server)
As Petesh menions, your server is not serving the file a mime type of application/vnd.apple.pkpass.
If using Apache, try adding the following to your .htaccess file or server .conf
AddType application/vnd.apple.pkpass .pkpass
If you are generating the .pkpass files manually, you can set the content header when serving the file. E.g. for PHP you can use:
header('Content-Type: application/vnd.apple.pkpass');

Resources