Skip to main content

Need to make jMaki use relative paths instead of trying to write full URLs

3 replies [Last post]
wadechandler
Offline
Joined: 2003-06-24
Points: 0

All,

jMaki works fine in my debug environment, but when I try to use Yahoo maps and put it on my server the client side which tries to load JavaScript is still trying to use localhost/127.0.0.1. I'm not talking about the Yahoo domain specifics such as Map access, but specifically for the .js files on my server.

I am using Apache on my server to run GlassFish behind a reverse proxy. Thus an internet request comes in, Apache checks to see if the request is to be reverse proxied, and if so, it then makes a connection to my internal GF server, and hands the information back as if it had served the request instead of GF, and thus to GF the request is coming from which ever IP address Apache is requesting the information which happens to be localhost/127.0.0.1 at this time , but in the future will be on a separate machine, but still an internal only IP address.

I can take the generated jMaki client side logic and hard code it and make the client side things work for the JavaScript, but some how I need to tell jMaki to not try to determine the actual URL requested and parse that to get the server IP and port, but to instead just use the context path to build its requests, so instead of setting up JS library paths using:
127.0.0.1:8080/contextpath/whatever/something.js

I need it to serve up

/contextpath/whatever/something.js

Does this make sense? Is this possible? If so, what are the configuration options, where do they go, or even better, where in the documentation is this information so I can figure it out myself?

Thanks,

Wade

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
wadechandler
Offline
Joined: 2003-06-24
Points: 0

Well, not so much relative paths, but just to leave off the server and the port to allow the browser to use a full path to the current server and port. Thus, have jMaki output paths beginning with a /contextpath (/ first) instead of contextpath/ (not having the / first)

Thanks,

Wade

gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi Wade,

We do have support for reverse proxies in jMaki via some context properties that you can put in your web.xml to specify the context root of your web application.

For normal http: try :

jmaki-webroot http://myhost.com/foo

For https:

jmaki-https-webroot http://myhost.com/foo

We also have a third property which does similar what you say in your second post and makes requests use relative paths. I do not believe we add on the context root:

jmaki-userelativepaths true

We have not had as much extensive testing with this option but would be more than happy to help you if you have issues with it. I would suggest the jmaki-webroot given we have two big production sites using that technique.

-Greg

wadechandler
Offline
Joined: 2003-06-24
Points: 0

Thanks Gregg. I'll use the webroot method. That will take care of my needs.

Wade