These are chat archives for spring-cloud/spring-cloud

7th
Dec 2018
muhmadtabrez
@muhmadtabrez
Dec 07 2018 04:46
@marcosbarbero the port of api gatweay is 8088. i tried calling the api with localhost:8088 as well but i got the same result.
Marcos Barbero
@marcosbarbero
Dec 07 2018 07:00
I think you have some misunderstandings @muhmadtabrez. With this configuration you should always be requesting it from the gateway, well, you can also request it directly but it wouldn’t make a lot of sense.
As for the servlet context in the microservice, it would affect the gateway dispatch. It seems that you are using a service discovery, the app context isn’t supported by it.
So, I would advise you to remove the context-path
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:11
@marcosbarbero thanks for you suggestion i will try out this.
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:18
and remember to request it through the gateway @muhmadtabrez :smiley:
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:42
@marcosbarbero I had commented the the contextpath
image.png
but still i am geting 404. now the existing route is also not working
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:43
how are you requesting it?
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:44
image.png
i am requesting it using api gateway
image.png
the above one is new route
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:46
just the url would do, you don't need to upload the screen shots.
anyway, does this request work? http://localhost:8091/getalllocation?listType=1
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:47
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:48
yes this works fine
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:48
if you removed the servlet-context there shouldn't be /core-location anymore
what's the spring.application.name in the microservice config?
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:50
it is core-location
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:51
I think I found the problem
your Gateway config is wrong, if you look at it you'll see you have the wrong indentation for the services right after routes
there should be couple of spaces after routes
zuul:
  routes:
    core-location:

# instead of
zuul:
  routes:
  core-location
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:53
i will give my gateway configuration please suggest it is correct or not
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:53
if you can paste it here using markdown, screenshots are not really helpful
wrap it using ```
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:54
ok
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:55
use ``` before and after the config
muhmadtabrez
@muhmadtabrez
Dec 07 2018 10:56
  ignoredServices: '*'
  host:
    connect-timeout-millis: 20000
    socket-timeout-millis: 20000  
  routes:
    core-location:
      path: /core-location/**
      stripPrefix: false
      serviceId: core-location
      sensitiveHeaders:
    core-location-api:
      path: /api/core-location/**
      stripPrefix: false
      serviceId: core-location
Marcos Barbero
@marcosbarbero
Dec 07 2018 10:57
maybe it will be easier if you just use https://pastebin.com/?
muhmadtabrez
@muhmadtabrez
Dec 07 2018 11:04
```    zuul:
      ignoredServices: '*'
      host:
        connect-timeout-millis: 20000
        socket-timeout-millis: 20000  
      routes:
        core-location:
          path: /core-location/**
          stripPrefix: false
          serviceId: core-location
          sensitiveHeaders:
        core-location-api:
          path: /api/core-location/**
          stripPrefix: false
          serviceId: core-location  ```
is it fine now
Marcos Barbero
@marcosbarbero
Dec 07 2018 11:05
well, not really
i'll be absent now for about 15min, maybe you can just send it as screenshot
or use gist to paste it
muhmadtabrez
@muhmadtabrez
Dec 07 2018 11:27
@marcosbarbero it worked as a charm if remove stripPrefix: false ;)
Thanks a lot for helping and i learnt new thing about gist thanks for that
Marcos Barbero
@marcosbarbero
Dec 07 2018 11:31
you're welcome!