AppEngine online and dev_server have different behavior handling URL

57 views
Skip to first unread message

Xi Shen

unread,
Mar 18, 2014, 11:07:34 PM3/18/14
to google-a...@googlegroups.com
Hi,

I am working with app engine 1.9.0. On my local environment, below URL works fine:

http://localhost:8080/blog/api/sync/TEST%20with%20slash%20%2F%20a%20slash

Notice the bold part after decoded is "TEST with slash / a slash".

In my application, this URL request is send to my application. But in online environment, this request is not send to my application. The request is handled by app engine directly and returned 404. I think the problem is related to the encoded slash.

Vinny P

unread,
Mar 19, 2014, 1:21:03 AM3/19/14
to google-a...@googlegroups.com
How are you mapping your URLs in app.yaml? As long as you're using wildcards appropriately, this URL should still work and be routed through your application.

As a side note, this looks to be an API endpoint. If you need to pass through data to your API, it may be better to wrap "TEST with slash" inside a JSON object and POST it to the API, instead of adding it to the URL.
 
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Xi Shen

unread,
Mar 19, 2014, 6:34:53 AM3/19/14
to google-a...@googlegroups.com
Yes, I use wildcards in my app.yaml, and on my local the URL is passed to my application, and my application will handle more detailed routing logic.

I found a walk around, and it looks weird...

On the client, in JS code, I double encode "TEST with slash / a slash", using "encodeURIComponent", then this request can be passed to my application. I have tested it both on my local and online environment.





--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/7ty9Df-wlec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
David Shen

http://about.me/davidshen
https://twitter.com/#!/davidshen84

Vinny P

unread,
Mar 20, 2014, 3:47:32 AM3/20/14
to google-a...@googlegroups.com
On Wed, Mar 19, 2014 at 5:34 AM, Xi Shen <david...@gmail.com> wrote:
Yes, I use wildcards in my app.yaml, and on my local the URL is passed to my application, and my application will handle more detailed routing logic.

I found a walk around, and it looks weird...

On the client, in JS code, I double encode "TEST with slash / a slash", using "encodeURIComponent", then this request can be passed to my application. I have tested it both on my local and online environment.




 Are you using the the blog title in the URL to figure out which blog post to display to the user?

Generally blog frameworks don't do that; it's easier to assign an unique ID per post then record both the ID (to look up the post) and the blog title (for SEO) in the URL. Also, it helps readability if you replace the spaces with underscore characters.

Xi Shen

unread,
Mar 20, 2014, 5:45:24 AM3/20/14
to google-a...@googlegroups.com
Yes, I know it looks weird in the URL. I am just doing some testing and noticed this inconsistency behavior in dev_server.py and appengine online. If you guys don't think it is an issue in app engine, that's your call. :)



--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/7ty9Df-wlec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages