swagger.json uri mapping does not work in Silex app - silex

I am developing a REST api using PHP and Silex and Swagger. In a local development environment I am trying to map the uri http://localhost:8888/swagger.json to the swagger spec. However, the silex routing mechanism in a local dev mode does not seem to like uri's that end with ".json". I can get this to work when I deploy the application to an http server, but not in local dev mode. Does anyone know if this is a config issue in Silex? Thanks.

In case anyone wants to refer to this later. I found a solution. To get this to work in my project, which is based on the Silex skeleton project (https://silex.symfony.com/download). The skeleton project includes web/index_dev.php. I created a task in my composer file that runs the php local/dev server for the project using that file. The task looks like this:
php -S localhost:8888 -t web /web/index_dev.php

Another solution to this problem can be found at:
https://silex.symfony.com/doc/2.0/web_servers.html#php-5-4
Look near the bottom of the page for the "PHP" section.

Related

Internal Server Error with Craft CMS 3

I'm installing Craft CMS 3 on a staging environment at http://staging.overlookpro.com and am having issues getting the CMS to show. I've installed Craft CMS 3 using Composer and selecting staging.overlookpro.com as my web root folder on my server. The folders that are installed are in this format: staging.overlookpro.com/craft/*.
On my local copy I am using MAMP on macOS and the CMS works completely fine. But for some reason the staging and production sites keep showing an Internal Server Error. I've made sure I had PHP 7 installed, but the control panel will not show.
if it shows completely fine in your local environment, so make sure your URL should point to the web directory.
For admin login : http://<Hostname>/index.php?p=admin/install
You have to use it in this format, then it will work out:
https://wedot.ch/index.php?p=admin/install
Or you can use it like this:
https://wedot.ch/admin/install
Your URL must Point to your web Directory.
Use this URL: http://<Hostname>/index.php?p=admin/install

Universal Links on iOS with Ember.js

I have a simple ember.js app, and I would like to support Universal Linking to my native iOS app. I have successfully done this with a simple apache server or node server, but I am new to ember.js.
How would I configure my ember.js app so that it serves a raw json file from the root directory of my site, like:
http://example.com/apple-app-site-association
The Content-Type of this file needs to be set to application/json as well.
Is there an easy way to do this in ember.js?
I tried just putting the file in my dist folder after building, but that didn't work.
The answer is so simple I'm tempted to just delete the question.
All ember serve does is serve the contents of the dist folder.
If you need a differently-configured server, just take the contents of the dist folder after running ember build and serve it from your own server. Then you can configure it to serve the apple-app-site-association file as you need.

404 on Openshift URL, URL fine on dev

I have a website that I am developing locally and pushing to RH Openshift with a PHP-5.4 and MySQL cartridge.
Most URL's work, but I am having an issue with some page URL's being recognised locally, but returning a 404 on Openshift.
Example: on development the following URL works: local.development.local/public/reset.php but visiting the Openshift url: example.rhcloud.com/public/reset.php returns a 404. However, example.rhcloud.com/reset.php works, even though reset.php is within the public folder directory.
The folder structure is the exact same on development as it is within Openshift repo folder.
Is there a specific setting I need to set in my Openshift environment to get it to recognize the URL?
The problem was due to the directory structure I had given my website. Since I had placed the majority of my code within a folder named public, Openshift was using that as the DocumentRoot. This wasn't my required functionality, so I renamed the folder to app, updated my URL's and this resolved the issue. Blog post giving the Openshift DocumentRoot logic can be found here: https://blog.openshift.com/openshift-online-march-2014-release-blog/

Rails application issue after deployment - 404 error

I'm new to RoR.
I was able to install Rails and host it in Webrick (Sample App with "Welcome" controller) in my windows.
Now i have a Unix Weblogic Server along with a dedicated domian.
After exporting the .WAR file using Warbler, i accessed the Oracle Admin Console from where i deployed the .WAR file in the dedicated domain. I did all this for the Sample app with only the Welcome controller in it.
But even after deploying the WAR file, on accessing the Domain along with the Port Number (:9002) i ended up with 404 file not found error On looking at the server logs,there wasn't any records relating to any error. The Application must have been deployed properly. I assume that i must have missed out on some basic configurations in the routes.rb or similar files before deploying. Can anyone Guess what are all the possibilities and if possible can anyone help me by pointing to any tuts that cover the Steps to be carried out for configuration before deployment. do i need to install both JRuby and Rails inside the server before depolyment?
I can't really guess with Eror 404 only.
You can try mapping your rails app rack config to a different base_uri.
All you need to do is wrap the existing 'run' command in a map block
try doing this in your rails 'config.ru' file:
map '/mydepartment' do
run Myapp::Application
end
Now when you 'rails server' the app should be at localhost:3000/mydepartment .
Not sure if this will give you the desired outcome, but worth a try.
One more thing you also add this to your config/environments/production.rb and config/environments/development.rb (if on production mode):
config.action_controller.asset_path = proc { |path| "/abc#{path}" }
otherwise when you call your helpers such as stylesheet_link_tag in your views, they will generate links without the "/abc".
Also, find some guides you may refer for good support.
JRubyOnRailsOnBEAWeblogic.
Use JRuby with JMX for Oracle WebLogic Server 11g
Let me know if it is not resolved.

Running jRuby + Rails inside of Tomcat

I am currently using a platform where multiple web applications must interact with each other in a frameset. This set of web applications and the frameset is hosted on Tomcat.
Now the application we're working on is developed with jRuby and Rails. Is there anyway I can run my development environment inside of Tomcat similar to just running the jRuby -S Rails Server command so I can effectively debug?
The only way I've found is to generate a war using warble and then modifying the exploded war which seems really hacky. Any thoughts?
EDIT: I think my best bet is to generate a war, gut it, use symbolic links and figure out what gems / libs I need to copy from the war generation process. It's the best way I can think of.
one option to explore: deploy a little servlet to Tomcat which returns
HTTP/1.1 301 Moved Permanently
Location: http://localhost:3000
So far the best solution I have found is to setup a reverse proxy with Tomcat and point it to the Rails development server. This allows it to run, as expected on the client side, while still giving me debug control.
When I get a chance to do some more testing I'll edit my answer to include additional information.
go to the webapps folder in tomcat where you have deployed the war file, then find the web.xml file inside the expanded war file
The path to this file is generally /var/lib/tomcat7/webapps/your-project-here/WEB-INF/web.xml and inside this file you should find the
Changing this is one way to go about.
<context-param>
<param-name>rails.env</param-name>
<param-value>production</param-value>
</context-param>

Resources