Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support other url configurations #176

Open
Krinkle opened this Issue · 5 comments

2 participants

@Krinkle
Collaborator

In order to not depend on a very specific RewriteEngine configuration (in case of Apache), we could also implement settings for path and page-item paths.

And the Linker utility would use those. By default it would be like this:

{
    "page_path": "/index.php?action=$1",
    "page_item_path": "/index.php?action=$1&item=$2",
}

And we could include the following in testswarm-sample.json, matching the recommended .htaccess-sample:

{
    "page_path": "/$1",
    "page_item_path": "/$1/$2",
}
/**
 * @param string $page
 * @param string $item [optional], can be left out if only page or page and query are needed.
 * @param array $query [optional] additional query parameters (appended with [?&]=)
 */
function ( $page, $item = null, $query = array() ) {
}

This would make #174 redundant as feature request (of course we can still add sample configurations for other servers, but it would work out-of-the-box for any web server that supports PHP).

@jzaefferer
Owner

I don't yet understand how this would work. Would you still need rewrites?

@Krinkle
Collaborator

We would still recommend using rewrites, but TestSwarm would no longer break if you don't want to or can't use rewrites. And urls will automatically use the correct structure based on your configuration.

@jzaefferer
Owner

Got it now. Allows you to configure how "pretty" URLs are generated internally. Let's do it!

@Krinkle
Collaborator

Thinking about this the other day, it does add a layer of complexity. Not just in the backend of TestSwarm, but also for consumers. As given the root of a TestSwarm one can then no longer reliably determine the canonical location of a page.

Though I think that'll be fine as it only applies to the index.php entry, not api.php. Any links an application will generate should/will/do come from the API, which knows the correct location (with the RESTful design, consumers must never form their own urls).

Just thought I'd mention that here.

@jzaefferer
Owner

consumers must never form their own urls

Would be interesting to see that actually implemented. I don't think I've ever worked with an API where that actually worked out.

I'm still okay with giving it a shot, but we should be careful and question that assumption about never forming your own URLs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.