Forum Discussion

jakub's avatar
jakub
New Contributor
5 years ago

Swagger behind Nginx instead of Zuul

How does Zuul make it swagger on http://foo-service:8080 works correctly for external access from http://public.com/foo-service ?

 

I have a task to replace Zuul with nginx (It's not my decision, I can't change it). I rewrite in nginx http://public.com/foo-service/names-controller/swagger-ui.html to http://foo-service:8080/names-controller/swagger-ui.html , but in swagger response I get broken links - without /foo-service/ that is I get http://public.com/names-controller... instead of http://public.com/foo-service/names-controller/.... With Zuul it was working fine out of the box - magic.

 

Is there any http request header Zuul is setting that is used by swagger?

How does Zuul make it Swagger works fine?

How could it be done in Nginx?

  • Hip Hip ...

    proxy_set_header X-Forwarded-Prefix /foo-service/;

    helps.

  • jakub's avatar
    jakub
    New Contributor

    Hip Hip ...

    proxy_set_header X-Forwarded-Prefix /foo-service/;

    helps.