Always return the first API

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:29:55 +0000.
Sender:[email protected].
Date:Thursday, 5 November 2015 19:37:58 UTC.

Hi guys I hope you can help me :slight_smile:

My problem :

I have two api with diferents this targets :

1:
Target url : http://10.192.40.33:8090/serviciosweb/calificacion/api/

API url : http://testorg.tyk.docker:8888/matadero/calificaciones/

2:
Target url : http://10.192.40.10:8090/servicioHotel/rest/api/
Api url : http://testorg.tyk.docker:8888/matadero/hotel/

When client try to request to a target url but with my ip(http://myIP:8888/matadero/hotel/) , always redirect the same api(http://testorg.tyk.docker:8888/matadero/calificaciones/) to the client in this case the number 1 , but if I do the request in my pc with the target url without changing the ip (http://testorg.tyk.docker:8888/matadero/hotel/) it works.

Imported Google Group message.
Sender:Martin Buhr.
Date:Thursday, 5 November 2015 19:55:49 UTC.

Hi,

It looks like you have the same API-slug (or listen path) for each API (matadero), that can’t work, you’ll need to set a different API-slug for the second API.

Maybe change both so that one is /calificationes and the other /hotels?

Cheers,
Martin


From: [email protected]
Sent: Thursday, November 5, 2015 19:38
Subject: Always return the first API
To: Tyk Community Support [email protected]

Hi guys I hope you can help me :slight_smile:

My problem :

I have two api with diferents this targets :

1:
Target url : http://10.192.40.33:8090/serviciosweb/calificacion/api/

API url : http://testorg.tyk.docker:8888/matadero/calificaciones/

2:
Target url : http://10.192.40.10:8090/servicioHotel/rest/api/
Api url : http://testorg.tyk.docker:8888/matadero/hotel/

When client try to request to a target url but with my ip( http://myIP:8888/matadero/hotel/) , always redirect the same api( http://testorg.tyk.docker:8888/matadero/calificaciones/) to the client in this case the number 1 , but if I do the request in my pc with the target url without changing the ip ( http://testorg.tyk.docker:8888/matadero/hotel/) it works.

–
You received this message because you are subscribed to the Google Groups “Tyk Community Support” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web, visit https://groups.google.com/d/msgid/tyk-community-support/1c03c141-c16a-4907-b381-fc27bf2a9386%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:[email protected].
Date:Thursday, 5 November 2015 20:18:05 UTC.

HI martin well I don’t know but I have diferents api slug for every target :

Api slug of the target 1 :

matadero/calificaciones

api slug of the target 2:

matadero/hotel

Ty :smiley:

Imported Google Group message.
Sender:Martin Buhr.
Date:Thursday, 5 November 2015 20:30:54 UTC.

Hi,
Yeah I don’t think that will work, the slug is meant to be a single word or words with hyphens. If you want that prefix you’ll need to modify the host manager templates (very easy).
Get rid of the “matadero” bits and the slashes and you should be fine.
Cheers,
Martin

Imported Google Group message.
Sender:[email protected].
Date:Thursday, 5 November 2015 20:43:55 UTC.

Well my friend I did what you told me

now my api slugs are :

1: api-calficaciones (http://myIP:8888/api-calificaciones/)

2: api-hotel (http://myIP:8888/api-hotel/)

still doesn’t work =/

I don’t see very efficent change the host manager template

ty :smiley: and sorry for asking too much but I need help hahahaha

Imported Google Group message.
Sender:Martin Buhr.
Date:Thursday, 5 November 2015 21:20:52 UTC.

Hmmmm, this is something to do with the host manager.

You’ll need to look at the tyk_nginx container, in particular the nginx sites-available folder to see what configurations are being generated.

Did you follow the QuickStart instructions for docker exactly?

The only reason the routing would fail is because nginx is routing the API slugs wrongly by matching them both to the same (default) configuration.

Suggest looking at what is being generated to diagnose, can’t help more than that until is see the nginx configurations that are being generated by host manager.

Ta,
Martin

  • show quoted text -

  • show quoted text -

–
You received this message because you are subscribed to the Google Groups “Tyk Community Support” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web, visit https://groups.google.com/d/msgid/tyk-community-support/1bef91c9-439f-4f45-8322-4874e3c6cf84%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:[email protected].
Date:Thursday, 5 November 2015 21:31:01 UTC.

Well tomorrow I will test changing the http://testorg.tyk.docker/ for my ip in the servername of nginex.conf

btw with the listen path it works :smiley:

ty for the help my friend :smiley:

Imported Google Group message.
Sender:[email protected].
Date:Friday, 6 November 2015 12:58:46 UTC.

HI Martin good morning :smiley:

can you help me with the hostmanger template ?

What do I need to change ?

this is my hm:

server {
listen 8080;

    # {{ .Org.CNAMEEnabled }}
    # {{ .Org.CNAME }}

    {{if .Slug}}
    server_name {{if .Org.CNAMEEnabled}}{{.Slug}}.{{.Org.CNAME}}{{end}} {{.Slug}}.{{if .Org.OwnerSlug}}{{.Org.OwnerSlug}}.{{end}}tyk.io;
    {{else}}
    server_name {{if .Org.CNAMEEnabled}}{{.ApiId}}.{{.Org.CNAME}}{{end}} {{.ApiId}}.{{if .Org.OwnerSlug}}{{.Org.OwnerSlug}}.{{end}}tyk.io;
    {{end}}

    gzip              on;
    gzip_buffers      16 8k;
    gzip_comp_level   4;
    gzip_http_version 1.1;
    gzip_min_length   1280;
    gzip_types        text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp;
    gzip_vary         on;

    # The Go application server
    location / {
        rewrite /(.*) /{{.ApiId}}/$1 break;

        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_pass http://tyk;
    }


} 

Ty =D