Shortened URL for VLF-ONE

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
starbg
Posts: 10
Joined: Sat May 14, 2016 12:27 am

Shortened URL for VLF-ONE

Post by starbg » Fri Jan 12, 2018 6:35 am

I am trying to shorten something like this:

Code: Select all

http://10.0.0.140:8081/DCZPGMLIB/ITG/ABC_OEXEC.HTML?Lang=ENG&FrameworkID=ABC_SYSTEM&material=Y
to at least this:

Code: Select all

http://posdev.abcsupply.com:8081/posweb
but preferably this:

Code: Select all

http://posweb.abcsupply.com/xxx (where xxx directs to the target LPAR and LANSA environment) 
After a bit of trial and terror, the first cut is working, using an Apache rewrite rule:

Code: Select all

RewriteEngine On                                                                                   
RewriteRule ^/POSWeb$ /DCZPGMLIB/ITG/ABC_OEXEC.HTML?Lang=ENG&FrameworkID=ABC_SYSTEM&material=Y [L]
I would like for the browser URL to not change upon rewrite, but no matter what options I've tried, it still does. Anyone know how to get around that?

Also, is there any way to encapsulate the port and simplify to my final preference without involving Infrastructure and changing DNS?

jyoung
Posts: 669
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Shortened URL for VLF-ONE

Post by jyoung » Fri Jan 12, 2018 7:46 am

We tried to do something similar without much success, simply could never get the server redirection working right.
Ended up with a client redirection solution which is not ideal as the URL changes, but it works for us.

Had some discussion regarding it here viewtopic.php?f=3&t=1193&p=2097. Brendan mentioned a way by modifying the httpd.conf of the web server.

Danny talked about one way of having an "friendly url" here viewtopic.php?f=4&t=47.
I don't know how / if VLF-ONE will have an impact on that technique.

Just thinking here, but you may be able to create a simple html page with an iframe in it that points to the VLF-ONE page .... ? :?

Joe

starbg
Posts: 10
Joined: Sat May 14, 2016 12:27 am

Re: Shortened URL for VLF-ONE

Post by starbg » Fri Jan 12, 2018 8:15 am

Thanks @jyoung,

Before posting I read your "vanity URL" and related posts. Interesting stuff, but not exactly what I was looking for. Since the Apache manuals say it is possible, I imagine there is just some twist that IBM did (or didn't do) for the IBM i version.

The quest continues ...

jyoung
Posts: 669
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Shortened URL for VLF-ONE

Post by jyoung » Fri Jan 12, 2018 8:20 am

That was the problem I ran into. Apache says its possible, but I could not get it to work IBM's version.

Let us know if you find a solution.

Joe

LANSAGuru
Posts: 68
Joined: Thu Mar 24, 2016 5:31 am

Re: Shortened URL for VLF-ONE

Post by LANSAGuru » Sat Jan 13, 2018 3:59 am

These are the modifiers for rewrite rules on Apache on IBMi.

NC = not case sensitive
PT = pass thru
R = redirect
L = Last
N = Next

Instead of this...
RewriteRule ^/POSWeb$ /DCZPGMLIB/ITG/ABC_OEXEC.HTML?Lang=ENG&FrameworkID=ABC_SYSTEM&material=Y [L]

Do this
RewriteRule ^/POSWeb$ /DCZPGMLIB/ITG/ABC_OEXEC.HTML?Lang=ENG&FrameworkID=ABC_SYSTEM&material=Y [NC,PT,L]

I typically use not case sensitive (NC) because you really don't want that.

Last (L) is optional unless you want it to do no more rewrites. If the rules never overlap this is not typically a problem, but I left it in anyway for your example.

The important bit is the PT which doesn't redirect the browser to a new page, but instead does the redirect internally, and the user never sees it.
This makes it really hard to debug if something goes wrong. During development I will use the R so I can see what is going on, but then for QA and staging and finally production I will switch from redirect (R) to pass thru (PT).

This should do what you want.

MarkD
Posts: 640
Joined: Wed Dec 02, 2015 9:56 am

Re: Shortened URL for VLF-ONE

Post by MarkD » Mon Jan 22, 2018 10:19 am

This may be related and a simpler solution - http://docs.lansa.com/14/en/lansa048/in ... 8_2915.htm

starbg
Posts: 10
Joined: Sat May 14, 2016 12:27 am

Re: Shortened URL for VLF-ONE

Post by starbg » Mon Jan 22, 2018 11:30 am

That's great Mark, thanks!

I'm still learning all this HTTP Server magic - I'm trying to support both SSL and non-SSL versions in the same config. At the moment, I can't figure out how to conditionally switch the ports as needed. I'll research Alias tomorrow within the different VirtualHost containers in the configuration.

Post Reply