Opened 14 years ago

Closed 14 years ago

#17 closed enhancement (fixed)

Photon: Allow Query Strings for Whitelisted Domains

Reported by: mdawaffe Owned by: barry
Priority: major Component: photon
Keywords: Cc:

Description

Attached:

  • Defines PHOTON__ALLOW_ANY_EXTENSION and PHOTON__ALLOW_QUERY_STRINGS constants.
  • Redefines the $origin_domain_exceptions to be an associative array where the keys are domains and the values are bitmasks of the above constants.
  • For domains where query strings are allowed, pass them via the 'q' query string (rather than attempting to encode them in the path).

For example, an image URL like:

http://image.example.com/image?foo=bar

is Photoned as:

http://photon.example.com/image.example.com/image?q=foo%3Dbar&resize=100,100

Attachments (2)

photon-17.diff (2.9 KB) - added by mdawaffe 14 years ago.
photon-17.2.diff (3.0 KB) - added by mdawaffe 14 years ago.
Bail if q on non-whitelisted sites

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by mdawaffe

Attachment: photon-17.diff added

comment:1 Changed 14 years ago by barry

Why did you decide to support query strings via a separate query arg rather than attempting to encode them in the path? It makes caching support more complicated because we either have to maintain the whitelist also in the caches or add the "q" arg to the cache key which defeats one reason for not supporting query args in the first place which is to prevent random requests from bypassing the cache.

Last edited 14 years ago by barry (previous) (diff)

comment:2 in reply to:  1 Changed 14 years ago by mdawaffe

Replying to barry:

Why did you decide to support query strings via a separate query arg rather than attempting to encode them in the path?

Because I originally thought it would be difficult to determine if the path was encoded or not. It turns out, with minor, ignorable edge cases, it should be easy to determine if a path is encoded: look for a "/".

As we discussed elsewhere, encoding the path makes things more opaque (a more objective sounding way of saying "ugly").

Instead, Photon should output an error if q is passed for a non-whitelisted domain.

Changed 14 years ago by mdawaffe

Attachment: photon-17.2.diff added

Bail if q on non-whitelisted sites

comment:3 Changed 14 years ago by barry

Resolution: fixed
Status: newclosed

(In [221]) Support for query strings in origin domains. Fixes #17. Props mdawaffe.

Note: See TracTickets for help on using tickets.