directories need trailing slashes

787 views
Skip to first unread message

Charles

unread,
Mar 30, 2010, 9:53:27 PM3/30/10
to Google App Engine
Hi all,

This is a pretty simple problem, but I'm not sure how to approach it
with GAE. The problem is this. I have an about page set up as an
index.jsp page under the directory /about/. So, when I access...

www.example.com/about/index.jsp
www.example.com/about/

...it works just fine. BUT, when I access...

www.example.com/about (notice, no trailing slash)

...it fails. I know why. It's interpreting it as a file and not a
directory. But, with traditional webservers like Apache, if it finds
no file, it will look for it as a directory and return the proper
page. An extra round-trip, sure, but it's definitely desirable. The
problem is, GAE doesn't seem to do that. The only solutions I've
found online were to do URL-rewriting, or create redirect servlets, or
dedicated servlets for certain pages. This seems excessive, and I'm
hoping I'm missing something. Anyone have any suggestions?

Thanks in advance


Charles

Charles

unread,
Mar 31, 2010, 12:22:04 AM3/31/10
to Google App Engine
Hmmm, I think I might have fixed it...but I don't get how.

I've added error-pages to my web.xml which catches 404 and 500 errors
and returns an appropriate error page (via
http://code.google.com/appengine/docs/java/config/webxml.html#Error_Handlers).
After I fixed and deployed that, the previous URLs that didn't work
(i.e. www.examples.com/about) all of a sudden started to redirect
properly (i.e. to www.examples.com/about/). Weird. I'm not sure
exactly what happened, but this seems to be a non-issue now. Anyways,
false alarm...I guess :p

Thanks


Charles


On Mar 30, 6:53 pm, Charles <char...@whoischarles.com> wrote:
> Hi all,
>
> This is a pretty simple problem, but I'm not sure how to approach it
> with GAE.  The problem is this.  I have an about page set up as an
> index.jsp page under the directory /about/.  So, when I access...
>
> www.example.com/about/index.jspwww.example.com/about/
>
> ...it works just fine.  BUT, when I access...
>

> www.example.com/about(notice, no trailing slash)

Segun Razaq Sobulo

unread,
Jul 22, 2016, 12:06:17 PM7/22/16
to Google App Engine
Thanks Charles, had the same issue and it was giving me headaches as yahoo oauth login was breaking because it was removing the trailing slash on specified redirect url. Going through your steps helped. Needed this link  https://code.google.com/p/googleappengine/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Component%20Status%20Stars%20Summary%20Language%20Priority%20Owner%20Log&groupby=&sort=&id=1477 though before I was successfully able to have appengine add trailing slashes when missing. Doing this in turn fixed the yahoo oauth login. 
Reply all
Reply to author
Forward
0 new messages