Configure Nginx to proxy different subdomain to a deeplink

While i would assume this to be no big deal i can't seem to get this right. What we are trying to achieve is set up an on-premise environment where we want to setup a list of urls like customer.domain.xx where each customer has its subdomain that should link to an internal addres like Our setup is that we have 1 front facing webserver that is used as an reverse proxy to our mendix apps to allow for custom domain names and ssl termination. I tried the following but that seems to cause for an infinit loop. location / { proxy_pass; } Edit: Just a small bump, is there anyone that has some experience in redirecting an url to a deeplink? Any thoughts on this are greatly appreciated. After reading up on this article i decided to change the architecture and i now have a second nginx server on the application server itself so that i can host all the static resources via a root directive. But my problem remains the same.
1 answers

Unfortunately I don't think you'll be able to get that to work. Setting up a url rewriter with nginx will redirect all request to the url that you have specified, this would mean that the entier Mendix platform should be served on that url and Mendix doesn't handle deeplinks that way.

Before explaining why this nginx config is creating a problem, first bit of background on the deeplink. The Mendix Deeplink module is a little bit strange since it isn't an actual link in the traditional form. When you use the deeplink module there is piece of Java code listening to select commands that are being send to /link/   
Everything that gets send to the /link/ url gets evaluated by the custom Java and if the input matches with a configuration out of the deeplink entity the only thing the code will do is store the url parameters in the 'PendingLink' entity. 

The only thing the deeplink module does is read the url and translate the url parameters into a new instance of the 'PendingLink' entity. After the entity was created it redirects the user to the home page (rememberd this step for the nginx config).

There is browser interaction, the client system isn't loaded nothing happens on the deeplink. It only creates an entity, and opens the homepage. We've probably all made the mistake of forgetting to use the 'DeepLinkHome' microflow on the homepage, and you would have seen the deeplink wouldn't work, because as I mentioned before the deeplink java code itself doesn't do anything (besides creating the entity). After being redirected to the default index page, the client will load and open the homepage.

The home page is where the deeplink is actually executed, the ExecuteDeeplink Java code in the DeepLinkHome microflow is what actually executes the logic you had configured in the deeplink.


Now that we know how the deeplink really works, let's get back to nginx. Let's assume that your server is listening to in your rewriter you have specified that all trafic to '/' will be forwarded to the deeplink url.

So if we remember how the deeplink works:
 - The user will open 
 - nginx will forward the request to
 - the deeplink custom Java is executed and it creates a PendingLink entity
 - the deeplink wants to redirect you to the homepage........? (this is where the problem starts)

Your application root ( isn't accessible through nginx, because of this the deeplink module can't redirect to the homepage and you'll probably only get a blank page. 


Because the deeplink itself doesn't server any content you can't have nginx redirect all requests to the deeplink. The deeplink code doesn't know what to do with this, nor is it able to server the client system.

No matter how you server the content, the platform intelligence (that is send to /xas/) can't be interpreted by your deeplink. As experienced users have seen all platform logic is communicated through the ../xas/ listener. This means that getting data, signing in, running a microflow is always send to  but with your request handler this ends up on:  and as you probably understand now, that doesn't go anywhere.


What is it exactly that you are trying to achieve with this deeplink? Maybe I can help suggest an alternative configuration in nginx, deeplink or custom Java to get to the same end result.