Reputation: 12095
I was wondering how to set a Foxx app at the root of the sever/ip/domain name?
For example if my IP was 100.12.32.12
if I go to http://100.12.32.12
it'll open the single-page foxx app without URL redirection.
Things I've Tried
Currently I got Arangodb to use tcp://0.0.0.0:80
endpoint, so I got the port to work.
I also set up a index.html
file in my app's manifest.json
and mounted that app to /
However currently going to http://100.12.32.12
redirects me to http://107.170.131.61/_db/_system/index.html
which works, but URL is changed.
Also http://100.12.32.12/index.html
works, but I was wondering if it's possible to get http://100.12.32.12
to show the app without the redirect.
I've tried sudo arangod --javascript.app-path /path/to/app
but that doesn't seem to work.
Thanks. I am new to Arangodb and Foxx.
Upvotes: 5
Views: 521
Reputation: 2764
Can you try the following? Open an arangosh in a terminal window or go to the JS shell in the GUI.
arangosh [_system]> db._routing.save({ url: "/", priority: 1, action: {do: "org/arangodb/actions/redirectRequest", options: {permanently: true, destination: "/index.html" } } })
{
"error" : false,
"_id" : "_routing/87048615",
"_rev" : "87048615",
"_key" : "87048615"
}
Restart the server (it needs to reload the now routing). Clear/Restart the browser (for chrome you might need to forget the visited sites). Check using telnet
> telnet localhost 8529
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
HTTP/1.1 301 Moved
location: http://localhost:8529/index.html
server: ArangoDB
content-type: text/html
connection: Keep-Alive
content-length: 183
<html><head><title>Moved</title></head><body><h1>Moved</h1><p>This page has moved to <a href="http://localhost:8529/index.html">http://localhost:8529/index.html</a>.</p></body></html>
If you do not see the correct address, check if the document was created in _routing correctly.
Now check with the browser. If this still shows the wrong redirect, flush the browser cache.
Upvotes: 3