Page 1 of 1
Shortened URL for VLF-ONE
Posted: Fri Jan 12, 2018 6:35 am
by starbg
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?
Re: Shortened URL for VLF-ONE
Posted: Fri Jan 12, 2018 7:46 am
by jyoung
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
Re: Shortened URL for VLF-ONE
Posted: Fri Jan 12, 2018 8:15 am
by starbg
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 ...
Re: Shortened URL for VLF-ONE
Posted: Fri Jan 12, 2018 8:20 am
by jyoung
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
Re: Shortened URL for VLF-ONE
Posted: Sat Jan 13, 2018 3:59 am
by LANSAGuru
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.
Re: Shortened URL for VLF-ONE
Posted: Mon Jan 22, 2018 10:19 am
by MarkD
Re: Shortened URL for VLF-ONE
Posted: Mon Jan 22, 2018 11:30 am
by starbg
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.