Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow regular expressions in proxies definition #1930

Open
madprog opened this issue Feb 25, 2016 · 2 comments
Open

Allow regular expressions in proxies definition #1930

madprog opened this issue Feb 25, 2016 · 2 comments

Comments

@madprog
Copy link

madprog commented Feb 25, 2016

Wished behavior

I would like to be able to tell Karma to serve a file whatever the sub-path is.
I could also want to transform the URL to something completely different.
For instance, something like this (but it won't work with the object syntax):

proxies: {
    /\/images\/.*/: "/base/test/assets/placeholder.png",
    /\/books/(\d+)\/pages\/(\d+)/: "http://external.host/get_book_page.php?book_id=$1&page_id=$2"
}

Proposed syntax

proxies could accept an object, as it is currently the case, or an array of arrays, which is still readable, and accepts regular expressions as "keys":

proxies: [
    [/\/images\/.*/, "/base/test/assets/placeholder.png"],
    [/\/books/(\d+)\/pages\/(\d+)/, "http://external.host/get_book_page.php?book_id=$1&page_id=$2"]
]
@PavelGavlik
Copy link

Support for regular expressions would be great.

Maybe Karma could support same confix syntax as Webpack does: webpack/webpack-dev-server#127 (comment) (This change has been merged in webpack/webpack-dev-server#187)

@LPCmedia
Copy link

Any plans on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants