search

Home  >  Q&A  >  body text

javascript - http-proxy-middleware path matching problem

I enabled the express server locally and added http-proxy-middleware to act as a proxy, but there were some problems with the matching path





{ context:'^.*/ajax-.*', options:{ target:'http://xxxxx:xxxx' } }

    

This can successfully match the address in the format of xxx/ajax-xxx. But if the address becomes xxx/ajax-xxx/xxx, it cannot be matched. It seems that it can only match one /. I don’t know why. Please help.

大家讲道理大家讲道理2780 days ago768

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-06-12 09:33:33

    '^.*/ajax-.*/**'

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-06-12 09:33:33

    This is the current solution, it just feels very awkward. . If you have a good way, I’ll add it here

    context:['^.*/ajax-.*','^.*/ajax-.*/*','^.*/ajax-.*/*/*']

    reply
    0
  • Cancelreply