Reputation: 357
I'm trying to set different folders according to mobile platforms, but I can't figure it out how to do it.
Here's some code:
App.yaml
- url: /winners
secure: always
static_files: static_files/winners.json
upload: static_files/winners.json
http_headers:
Content-Type: application/json; charset=latin-1
this works fine but when I set the query string like this:
- url: /winners?platform=android
secure: always
static_files: static_files/winners.json
upload: static_files/winners.json
http_headers:
Content-Type: application/json; charset=latin-1
It does not!
I basically want to send different resources according to each platform, is this possible?
Thanks :)
ps: Similar question that says "no" to what I want to achieve Define query param in app.yaml in Google Appengine
Upvotes: 1
Views: 209
Reputation: 39834
As the answer to the question you referenced, query parameters are ignored when routing via app.yaml
. But it is possible to offer different resources according to each platform, only using other mechanisms.
One approach could be by encoding the platform in the URL, but not as a query parameter, for example /winners/android
, handled via this app.yaml
routing:
- url: /winners/(.*)$
secure: always
static_files: static_files/\1/winners.json
upload: static_files/\1/winners.json
http_headers:
Content-Type: application/json; charset=latin-1
Which would serve a file stored as static_files/android/winners.json
More details in Static file pattern handlers.
Upvotes: 3