how to preserve kong domain name in ui redirection - api-gateway

I am using kong 2.5 for APIs and Microservice routing and I got a requirement to place react ui application behind kong.so,I have created below service pointing to my UI application.
{host : www.example.com,
protocol : http,
path: /,
port: 80}
I have created route for the same.
{
Host : www.mykongeg.com,
Paths : {/maps/home},
strip_path : false,
preserve_host : false
}
Kong domain : www.kongeg.com
So when I tried to access ‘www.kongeg.com/maps/home’, it is redirecting to ‘www.example.com/maps/home’ on browser.
is it possible to preserve kong domain name on browser without modifying to service url ?. so when I access ‘www.kongeg.com/maps/home’, it should display content returned by ‘www.example.com/maps/home’.
Thanks

Related

How to point a domain name to specific subdomain on Windows Server

I have purchased a domain name (https://example.com) from namecheap. I have a subdomain (https://subdomain.go.com:444) running on specific port on windows web server. If someone visits (https://example.com), I would like him to land on my subdomain (https://subdomain.go.com:444). How can I achieve this?
I have tried URL redirect record in DNS settings on namecheap but that did not work.
Type : URL Redirect Record
Host : #
Value : https://subdomain.go.com:444
I also want the address to show as example.com instead of https://subdomain.go.com:444 in my browser(masking).
*** ref:- https://www.namecheap.com/support/knowledgebase/article.aspx/9678/2237/how-to-redirect-subdomain-to-a-certain-ip-address-along-with-a-port/

AWS API gateway: Custom domain supporting multiple Http APIs

I have created two lambda functions
register
login
and both of them are getting triggered from respective "Http APIs" in the API gateway. I have set up the stage for both of them as prod. Now I want to call them using my custom subdomain e.g prodapi.mydomain.com by setting the path as "v1"
prodapi.mydomain.com/v1/register
prodapi.mydomain.com/v1/login
I am able to achieve it for a single API but when I try to do API mapping for the other one using the same path, it doesn't allow that and says "ApiMapping key already exists for this domain name".
Any suggestion on how to achieve this?
can you share the endpoint url, before adding the subdomain, and after adding the subdomain
And can you explain your endpoints, how it should look like before adding the subdomain and after

GCP app engine flex not maping other services to subfolder

I have deployed a project on gcp app engine flex.
I have created the dispatch.yaml file and updated but my urls not working like i needed.
I got three versions running.
api-dot-site-appspot.com (service : api)
backend-dot-site-appspot.com ( service backend)
site-appspot.com (service : default)
i have added the custom doamin in gcp abc.com
all three application in laravel. and all flex urls working fine like api-dot-site-appspot.com . but with custom domain if i open like abc.com/api/ it gives 404
so main domain is abc.com
abc.com should open site-appspot.com
abc.com/backend should open backend-dot-site-appspot.com
abc.com/api should open api-dot-site-appspot.com
so please apply if you have expertise on it.
below dispatch.yaml file i deployed
dispatch:
# Send all mobile traffic to the mobile frontend.
#- url: "*/product/*"
# service: default
# Send all mobile traffic to the mobile frontend.
- url: "*/dashboard/*"
service: dashboard
# Send all work to the one static backend.
- url: "*/api/*"
service: api

ajax call to aws api gateway via hosted domain name does not work

I use api gateway connected to lambda as a service.
When I create api gateway I am able to call it via following:
var xhr = new XMLHttpRequest();
xhr.open('POST','https:/apigateway url');
xhr.onreadystatechange=function(event){
console.log(event.target.response);
}
xhr.setRequestHeader('Content-Type','application/json');
xhr.send(JSON.stringify({
"storyId": "100634850"
}));
Now I created a custom domain name and attached it route 53. So I use a certificate as well as follows:
Now when I use the above code this time with a custom friendly name with certificate Ido not get anything back> Am I missing anything?
Things to check:
The API Resources have been deployed to a stage
A Base Path Mapping has been added, e.g. www > [Select API] > [Select Stage]
CORS is set up correctly for the client if in a browser
The Certificate is for the right domain / wildcard, i.e. *.mydomainname.com
A CNAME has been added in Route53 for the custom domain name to the "Target Domain Name"
Your app has been updated to point to the new domain name + Base Path Mapping prefix

Spring and angular5 XSRF security issue

i have project where i using spring as backend (generated with microservices with jhipster) and angular5 as frontend
on server side setup CSRF security is added(it was by default enable when we create microservices with Jhipster)
as i work with angular , there is no need to make changes in angular code for dealing with XSRF token sending(csrf and XSRF are same things)
question background :
when i test both UI and apis locally it works great.in this case
server will setup cookies as XSRF-TOKEN on browser cache and angular app return this cookie in header for each request. this works fine at locally
angular app at local : http://localhost:4200
api gateway app local http://localhost:8080
question :
when i deploy this app on dedicated server
angular app at : http://111.22.33.44/angualrapp
api gateway at : http://111.22.33.44:8080
(above are the assumed domain , same pattern used for my apps)
when i did this setup i have facing following problem
- XSRF token is not getting stored at my browser cache
- each request gives me 403 Forbidden error (because ,i thought XSRF-TOEKN is null)
Q 1 . how did i get solved above problem ?
Q 2 . Is this configuration is possible when Angular and Spring code is deployed to different domains(origins)?
Q 3 . can i facing this problem due to domains i allocated to apps ?
hello friends i just go through deep in this issue , i get help from the following issue
Share cookie between subdomain and domain
Q 2 . Is this configuration is possible when Angular and Spring code is deployed to different domains(origins)?
ans : need to host both apps on same parent domain
for example:
angular app : angularapp.parentdomain.com
api's : apis.parentdomain.com:8080

Resources