non-root url not working when directly entered in browser address bar for ember app deployed in Jetty - ember.js

I have a simple app developed using Ember. It is more of a pet project than anything else. As I am familiar with Jetty, so I just deployed it into Jetty's webapps/ROOT. The problem is, I have to start the app with the root url: http://localhost:8080/. If I enter something like http://localhost:8080/foobar in browser's address bar, I will get a 404. But I can go to that page by clicking some link in the root page.
To my understanding, the reason why directly entering the non-root foobar url not working is that Jetty is trying to locate the foobar resource. Since the foobar resource is only resolvable inside the Ember app, Jetty can't find it and hence it fails to enter non-root url directly. However, my question is, how can I make that directly entered url work? If it can not be done or not easily be done with Jetty, I am open to use another http server.

Related

AWS Amplify and Vue router history mode

I have a Vue app that uses Vue router. Now I'm supposed to make a website for a client where one part is "secret" and can only be accessed through a direct link.
In other words, I want users to be able to navigate to myamplifyapp.com/mysecretpage just by entering this in the address bar.
I heard this works with Vue router history mode, set it up locally (apache) and everything is working well, but when I'm deploying it on Amplify, I can't access this page directly through a link, instead it just goes to index.html. Is there any way I can configure Amplify to make this work?
You can add a redirect to point users to index.html.
Something like this should work:
/<*> /index.html 200.
You'll probably want js/css files to not be redirected. For that you can try the reg exp from the link.

Serve multiple Django applications from one server

Good morning. I have a dedicated ubuntu server behind my company's firewall. It is using Django, Gunicorn, and Nginx to serve an Intranet application to employees. The original app responds to the URL [server_name]/[original_application_name]. I want to serve additional apps from this server. I have followed this tutorial as I did when setting up the original app.
I can run Gunicorn and serve the app, I have created a second systemd service file that appears steady (copied from the original app with paths changed - service runs), same for a new 'sites-available' file in Nginx (copied from original and modified), new .sock file exists, binding appears successful. However, I have yet to hit on the right configuration combination between settings.py [allowed_hosts], [new_app].service, and nginx etc.
The original app is running and when I try a URL related to the new app it gives an error saying it cannot find the request in the url.py of the original app. The new app would be used by the IT dept. Ideally, the new URL would be something like: it.[server_name]/[new_application_name].
I have looked through other cases with this problem but most use Apache or are on a public hosting site. I have seen this but it requires a "socket file". My original app is not using a socket file. I was hoping to do this without interfering with the original app. Is a "socket file" required? How can I configure this to serve both apps? Never having done this, what will the new URL be? The URL for the admin site in both apps is 'admin/', how can I accommodate this? Thanks!
I combined into one file as you suggested and I am almost there! I have original site responding at [server_name]/inventory and new site responding at [server_name]/assets. Great! My only problem is the admin page. In both apps the admin site is called admin! So, [server_name]/admin brings up the original site. How can I get to the new admin page?

Ember routing non-root domain

I am using the ember quick-start tutorial app. Everything works great locally, but when deployed to a test environment the app is 404ing on loading all resources.
I am deployed to a subfolder out somewhere and apparently ember is trying to find it against the root domain, instead of subfolder
Example:
http://example.com/embertest/index.html
The assets folder is obviously under http://example.com/embertest/assets/, but on load it's trying to grab it from http://example.com/assets/ which doesn't exist
How can I have ember use relative paths in this case?
Update 1
After some googling I tried editing the environment.js ENV.baseURL attribute
In the if(environment === 'production') block I added ENV.baseURL = '/website/dist/';, obviously I am building with ember build --env production
I am getting same 404s when going directly to a route but now also getting an error on index.html, Uncaught UnrecognizedURLError: /index.html
I tried every combination of '/website/dist/', 'website/dist/', '/website/dist' as well
Update 2
I have now also tried manually editing the <base href="/website/dist/"> in my index.html after a prod build. Same errors as from update 1
You need to understand that you can't just put an ember application to a normal webserver folder. Ember uses the history API to change the URL when you do a route change but it can't control what your web server deploys when its directly fetched.
So you have your ember index.html on http://example.com/app/index.html your web server usually will only deploy this file when you open http://example.com/app/ or http://example.com/app/index.html. But for a route foo your url is http://example.com/app/foo and your web server is looking for a directly foo that does not exist. So you have to configure your web server so its always responding with your index.html if your not requesting another existing resource (like an image, js or css file)!
How to do this depends completely on your webserver.
You must also notice that you should enter your assets in a full root relative path and specify rootURL so your router knows which part of the URL is your path and where your routing begins.
You should not use baseURL because its an upcoming deprecation!
You really should read this really new blog post!
Use ENV.locationType = 'hash' to prevent the usage of the history API is still always an option, but definitly an ugly one.
Okay so I solved this by changing ENV.locationType = 'hash' in environment.js
Would still love an explanation of what's going on as this feels a little bit hacky...

Use of window.location.href in crosswalk

I use crosswalk 5.34.104.5 to build Android app.
After executing
location.href = '/another_page.html'
in index.html, which is a entry point defined by manifest.json,
empty alert pops up and blank page appears.
another_page.html is located in the same directory as index.html
(i.e. it is in apk file whose path is assets/www/another_page.html relative to apk's root)
and is not served over network.
How can I achieve intended location transition?
It is a typo in "asserts/www/another_page.html", it should be assets, right? I can do the same thing with changing location.href to load another page.
EDIT: If you are using make_apk.py to package your app, you can pass "--enable-remote-debugging" to turn on remote debugging for your app. Once the app is launched on your device, open 'chrome://inspect' in Chrome browser running on the host machine, and inspect the page to directly execute "window.location.href=xxx" in console, and try to fix your problem. See https://crosswalk-project.org/#wiki/Remote-Debugging-on-Android for details.

Run fuel php app in AWS EC2 instance

I have a fuel php application created by one of my friend.Now I want to run it on aws EC2 instance(ubuntu).I can run the application using apache2 and its index page is loading.After facebook connect from index page it is supposed to show my fb friends list. But it is showing a 404 error POST http://ec2xxxxcompute.amazonaws.com/ajax/auth/facebook not found
I can see a get_facebook() method inside controller(/ajax/auth.php).But it is not catching the method.My top level understanding is i need some url mapping in server level.
Can anyone help me to run the app.Any suggestion will be highly appreciated as a biginner
Are any other URL's loading, or only the index page? If that is the case, it might be a rewriting issue.
Is the default .htaccess file still included in the /public folder? Or did your friend change it?
You may not actually be calling your php code at all. Don't you need something like :
http://ec2xxxxcompute.amazonaws.com/ajax/auth.php/facebook