spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Question migrate Apache httpd to spring gateway

Open mailsanchu opened this issue 1 year ago • 6 comments

Hello, I am trying to migrate the following apache httpd rule to spring gateway. So far it appears to be not working. Can you please lend me a helping hand?

ProxyPassMatch ^(\/v1)?\/rest\/v\/([^\/]+)\/m\/([^\/]+)\/path\/from\/(-?\d+\.?\d*),(-?\d+\.?\d*)\/to\/(-?\d+\.?\d*),(-?\d+\.?\d*)(\?.*)?$ http://localhost:8080/api/v1/public/v/$2/m/$3/path/from/$4,$5/to/$6,$7

mailsanchu avatar Apr 10 '24 16:04 mailsanchu

An example would be /rest/v/101/path/from/-10,10/to/20,-20

mailsanchu avatar Apr 10 '24 20:04 mailsanchu

    - id: v1_u_me_v_messages
      uri: http://localhost:8082
      predicates:
     `   - Path=/rest/v/{a:\d+}/path/m/{b:\d+}/path/from//{c:\d+},{d:\d+}/to/{e:\d+},{f:\d+}`

mailsanchu avatar Apr 10 '24 21:04 mailsanchu

Comma seems to have an issue there

mailsanchu avatar Apr 10 '24 21:04 mailsanchu

Is the == a typo?

All I can really do is point you at the path pattern javadoc, which gives the most detailed explaination of the syntax https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/pattern/PathPattern.html

spencergibb avatar Apr 10 '24 23:04 spencergibb

Yes it is a typo. I need to extract fields separated by comma and process it internally. I was hoping somebody had a better solution

mailsanchu avatar Apr 11 '24 07:04 mailsanchu

Thank you for your response @spencergibb

mailsanchu avatar Apr 11 '24 07:04 mailsanchu