0

I'm trying to use spring gateway with my sveltekit app, I have some working rest services already integrated in the gateway and I also added the svelte front end in the yml routes.

application.yml

spring:
  cloud:
    gateway:
      routes:
      - id: svelte
        uri: http://localhost:5173
        predicates:
        - Path=/**

localhost:5173 is being routed to localhost:8080 which is the port of the gateway

Regular routing of the SvelteKit UI like these works:

http://localhost:8080/items   <----- I can see the item list in the browser
http://localhost:8080/login   <----- I can see the login screen
http://localhost:8080/about   <----- I can see the about page

But for routing that uses [slug] for dynamic parameter

http://localhost:8080/item/1   <-------- error in gateway, and 500 error displays in browser

error in console of spring gateway:

java.net.URISyntaxException: Illegal character in path at index 41: http://localhost:8080/src/routes/item/[slug]/+page.svelte

folder hierarchy for the [slug] routing

src
├── +page.svelte
│   ├── item/
│   │   ├───[slug]
│   │   │   ├──+page.svelte

The slug routing works when I am not using gateway, this only happens when the UI is being routed in the gateway.

askwer
  • 163
  • 13
  • [Maybe you could rewrite the path](https://stackoverflow.com/questions/4992317/illegal-character-in-path-at-index-16) in the gateway? I.e. `http://localhost:8080/src/routes/item/%5Bslug%5D/+page.svelte` – Tholle Jan 10 '23 at 10:04

0 Answers0