symfony : application mobile on server on line - apache

I have a very simple question,I created my site unsing symfony 1.4,I also created three applications :
apps/frontend ==> exampel.com
apps/backend ==> example.com/backend.php
apps/mobile ==> mobile.example.com
for frontend and backend works fine on line server but for mobile version I created a subdomain(mobile.example.com) correctly but here is my problem.
How I configure symfony or server on line to access directly to mobile application when I browse the link mobile.exemple.com?
I mean I have all project in example.com folder not in subdomain(mobile.exemple.com) folder.
Any Idea?
Edit :
I hope subdomain for different applications not for different modules in one applicatoion!

The link to symfony blog from this question shows that you can use sfRequestRoute configuration for this.

I find a good solution and simple than using sfRequestRoute configuration,finally for me :
I change subdomain for different symfony applications and just to have one index.php controlling your project.
<?php
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
switch ($_SERVER['HTTP_HOST']) {
case 'm.example.com': $configuration = ProjectConfiguration::getApplicationConfiguration( 'mobile', 'prod', false); break;
case 'backend.example.com'.....
default: $configuration = ProjectConfiguration::getApplicationConfiguration( 'frontend', 'prod', false); break;
}
sfContext::createInstance($configuration)->dispatch();
and It's done.

Related

Laravel in Shared Hosting

I am trying to install a Laravel application in Shared Hosting following this tutorial where my server's PHP version is 7.1.17 and my Laravel version is 5.6.15.
When I am trying to browse my application using Chrome I can see only a White page, even no error is there.
I tried to debug the application and found that below code of index.php is not working.
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
What is the solution of this issue?
If there is no error_log or your error log are empty
Check if it's a php version is a latest 7.1 or higher
Make sure YOUR_PATH_DIR are correct
$app = require_once DIR.'/YOUR_PATH_DIR/bootstrap/app.php';
require DIR.'/YOUR_PATH_DIR/vendor/autoload.php';

setting "server name" when using kestrel with dotnet core

I am writing an app using asp.net mvc that right now runs against microsoft's kestrel server. It works fine, and I pass values to it at startup using a hosting.json file defined as follows;
{
"server": "Microsoft.AspNet.Server.Kestrel",
"server.urls": "http://localhost:5000;https://localhost:5001"
}
Is there any way to give the "server" a name, so that it isn't always reporting as localhost or undefined all the time?
Please replace localhost with *. This will give the below benefits:
If you give localhost, you can access the application only through http://localhost:5000 and not using IP [http://192.168.1.2:5000, an example]. By using *, you can access through the IP.
You can connect to the server from other PCs or Mobile Devices.
A few days back, I had the same requirements as yours and got the solution from: docs.asp.net. [The Comments section is hidden by default. Please click Show Comments and search for localhost.]
Tip 1: To view the application from a mobile device, please check: Viewing localhost website from mobile device.
Tip 2: My question and answer has been posted here: Compiling an ASP.NET 5 Web Application and generating DLL files.

Grails generating proper links when deployed behind proxy

Consider the following setup for a deployed Grails application.
the Grails application is deployed on a Tomcat server (tomcat7)
in front of Tomcat an Apache webserver is deployed
Apache does SSL offloading, and acts as a proxy for Tomcat
So far a quite standard setup, which I have used succesfully many times. My issue is now with the links generated by the Grails application, especially those for the redirects (the standard controller redirects, which occur all the time e.g. after succesfully posting a form).
One configuration is different from all the other applications so far: in this Grails application no serverURL is configured. The application is a multi-tenant application, where each tenant is given it's own subdomain. (So if the application in general is running under https://www.example.com, a tenant can use https://tenant.example.com.) Subdomains are set automagically, that is without any configuration at DNS or Apache level. Grails can do so perfectly, by leaving out the serverURL property in Config.groovy: it then resolves all url's by inspecting the client host.
However: when generating redirect-url's, Grails is not aware the website is running under https. All redirect url's start with http... I guess this is no surprise, because nowhere in the application it is configured we are using https: there is no serverURL config, and technically the application is running on the standard http port of Tomcat, because of the SSL offloading and proxying by Apache.
So, bottom line: what can I do to make Grails generate proper redirects?
I have tried to extend the DefaultLinkGenerator and override the makeServerURL() method. Like this:
class MyLinkGenerator extends DefaultLinkGenerator {
MyLinkGenerator(String serverBaseURL, String contextPath) {
super(serverBaseURL, contextPath)
}
MyLinkGenerator(String serverBaseURL) {
super(serverBaseURL)
}
def grailsApplication
/**
* #return serverURL adapted to deployed scheme
*/
String makeServerURL() {
// get configured protocol
def scheme = grailsApplication.config.grails.twt.baseProtocol ?: 'https://'
println "Application running under protocol $scheme"
// get url from super
String surl = super.makeServerURL()
println "> super.makeServerURL(): $surl"
if (surl) {
// if super url not matching scheme, change scheme
if (scheme=='https://' && surl?.startsWith('http://')) {
surl = scheme + surl?.substring(7)
println "> re-written: $surl"
}
}
return surl
}
}
(Maybe not the most beautiful code, but I hope it explains what I'd like to do. And I left out the bit about configuring this class in resources.groovy.)
When running this code strange things happen:
In the log you see the code being executed, and a changed url (http > https) being produced, but...
The redirect sent to the browser is the unchanged url (http)
And even worse: all the resources in the generated views are crippled: they now all start with // (so what should be a relative "/css/myapp.css" is now "//css/myapp.css")
Any help or insight would be appreciated!
Grails version is 2.1.1 by the way (running a bit behind on upgrades...).
It seems you're always talking https to the outside world, so your cleanest option is to solve the problem where it originates, at your Apache webserver. Add to httpd.conf Header edit Location ^http://(.*)$ https://$1, and you're done.
If you have limitations that force you to solve this in your application you could do the rewrite of the Location header field in a Grails after interceptor. Details of that solution are in this post.
Some years have past since this question was written, but problems remain the same or at least similar ;-)
Just in case anyone hits the same/similar issue (that Grails redirect-URLs are http instead of https) ... We had this issue with a Grails 3.3.9 application running on OpenShift. The application was running in HTTP mode (on Port 8080) and the OpenShift Loadbalancer was doing the SSL-Termination.
We solved it by putting
server:
use-forward-headers: true
into our application.yml. After that Grails works perfect and all the redirects created were correct with https://.
Hint: We have do not use grails.serverURL in our configuration

wrong paths on multi website magento install

I am running a magento 1.7.0.2 instance with WAMP 2.1 on Windows 7. My goal is to set up one magento store, and one
I followed the tutorial described here and I setup website profi on a subdirectory, but when I accessed the frontend on http://localhost/profi/ the first thing I noticed that the images paths were broken.
Broken: http://localhost/bms/profi/skin/frontend/default/default/images/logo.gif
Correct:
http://localhost/bms/skin/frontend/default/default/images/logo.gif
This is the same for the JS & CSS files. I've made the following modifications to the index.php file in the profi folder:
$mageFilename = MAGENTO_ROOT . '../../app/Mage.php';
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'profi';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';
It was a matter of configuring the second website's URLs.
I went to System > Configuration > General > Web > Unsecure. The Base URL was http://localhost/profi/ and I added ../ to the following the following:
Base Skin URL: {{unsecure_base_url}}../skin/
Base Media URL: {{unsecure_base_url}}../media/
Base JavaScript URL: {{unsecure_base_url}}../media/
That did the trick. I see on the frontend everything looks in order. Hope I won't run into anymore problems with this set-up.

Flex 4 - Technique to allow HTTPService testing locally and on development server

Right now I have my URLs hard-coded for HTTPService to work with my local machine's web server so that I don't need to copy files to htdocs after compiling. What's a good technique to easily transition HTTPService URLs from working on my testing setup to working with a normal web server setup?
Write a service to get the current environment your application is in, similar to how one tests if you're running in AIR or Flex.
In your HTTPService:
url="EnvironmentService.getURL1();"
In EnvironmentService:
public static function getUrl1():URL
{
return (LOCAL_ENVIRONMENT)? LOCAL_URL1 : LIVE_URL1;
}
If this doesn't work for you, post some more code and we'll work on a solution