Category Archives: azure

Unable to add header on Apache webserver hosted by azure

I am trying to enable Anti clickjacking on a website hosted by Azure.

Its a shared hosting package run on Apache server. Problem is that i cant find the correct conf file to modify and add this line of code to:

header always set x-frame-options "SAMEORIGIN"

we found a file called apache2.conf and added this but after restarting apache server the line is removed from the conf.

Anyone any ideas what i can do ?

Azure API gives nosuchmethod error

I previously asked this question on MSDN forums so here's a link to the question there as it has most of the details.

Essentially, I'm working with a maven managed project that makes API calls to a microsoft azure account. However, the api library seems to be having some issue as calling network.create() is causing a nosuchmethod error.

Please feel free to ask if you need any additional information.

Laravel – Azure DNS – Website url issues (url.com works , www.url.com does not)

I'm trying to setup my azure web app and having some issues with DNS and url

This is my htaccess in the root folder :

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

This is my htaccess in the public folder :

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

This is my godaddy records :

enter image description here

My websites works at url.com

but not for :

www.url.com

http://www.url.com

I get this page :

enter image description here

Drupal 7 doesn’t upload images styles

I have a drupal 7 hosted on windows azure as web app.

When I upload an image into a content, my original image is stored in the files folder but its corresponding image styles are not stored (example in the thumbnail folder).

I tried this:

  • Permissions 777/775
  • Comment the following lines in the htaccess located in the files folder:
#Options None
#Options + FollowSymLinks

I have the impression that it is Azure which blocks the writing of the files because the htaccess can be changed only in its own editor and not in my ftp.

Is It Possible To Perform A SQL Database Query As Part Of A WebConfig URL Rewrite Rule?

I'm currently in the process of migrating a PHP website from LAMP Hosting to Microsoft Azure Web Apps Hosting.

The site being migrated uses HTAccess for URL Rewriting purposes; however from what I can tell, Azure does not support the use of HTAccess files (please correct me if I am wrong in this) - instead, it appears that I must use IIS WebConfig for this purposes (a technology that I am not overly familiar with).

Assuming that I have to rewrite the file from HTAccess to WebConfig, the HTAccess file to be rewritten uses Mod_Rewrite and external Rewrite Maps as part of the URL rewriting process. The HTAccess Rewrite Map performs a Database Query as part of this process whereby a URL such as www.example.com/category/music is inputted and then re-written to www.example.com/category.php?catID=1, i.e. the ID associated with each category name is identified via a Database query.

I've familiarised myself with the basics of Web Config and IIS Rewrite Maps thus far; however I have only encountered tutorials outlining static rewrite rules.

Is it possible to perform database queries using IIS Config - similar to the HT Access scenario outlined above?

If so, can someone please point me in the direction of some tutorials dealing with the topic or provide some sample code.

Any help is much appreciated.

apache2 crashes when trying to dynamically load python module

I have a Django application, which has the following code init:

import importlib

def get_class(m):
    module_name, class_name = m.rsplit('.', 1)
    module = importlib.import_module(module_name)       
    return getattr(module, class_name)

Whenever I make a request which requires a call of this function, in the error.log I see child pid 27228 exit signal Segmentation fault (11), possible coredump in /etc/apache, and request fails with error code 500.

The strange thing is that if I call that function from the command line, everything works well. Seems like mod_wsgi does not allow to dynamically load a python module.

I tried to do the following with all combinations:

  1. Use virtual environment

  2. Downloaded sources of python 3.6, compiled and installed it,

  3. Recompiled the mod_wsgi for both default python 3.4.3 and new python 3.6.

The error is always the same:

OS: Ubuntu Server 14.04 Apache: 2.4.7 Python: 3.4.3, 3.6.0

On my Ubuntu Desktop 14.04 everything works fine. Apache is installed by sudo apt-get install apache2

in /etc/apache2/sites-enabled/000-default.conf

<Directory /my/django/app/appp>
    <Files wsgi.py>
    Require all granted
    </Files>
</Directory>
WSGIDaemonProcess myapp python-path=/my/django/app
WSGIProcessGroup myapp
WSGIScriptAlias / /my/django/app/app/wsgi.py
WSGIApplicationGroup %{GLOBAL}

UPDATE:

I have downloaded and compiled apache2 and recompiled mod_wsgi. Still the same problem.

UPDATE 2: Not sure if this will help, but the OS is on a Azure VM with Ubuntu Server 14.04

Drill to Hive connectivity error(org.apache.thrift.transport.TTransportException java.net.SocketException: Broken pipe (Write failed))

I am getting the following error:

ERROR hive.log - Got exception: org.apache.thrift.transport.TTransportException java.net.SocketException: Broken pipe (Write failed) while trying to connect Drill to Hive. 

For "Hive" Microsoft Azure HDInsight (Remote metastore (MS SQL Server)) is getting used and for Drill I am using other VM which is under same VNet as cluster. I am able to make Drill Storage plugin with below configuration

{
"type": "hive",
"enabled": true,
"configProps": {
"hive.metastore.uris": "thrift://hn0-xyz.cloudapp.net:9083,thrift://hn1-    xyz.cloudapp.net:9083",
"hive.metastore.warehouse.dir": "/hive/warehouse",
"fs.default.name": "wasb://[email protected]",
"hive.metastore.sasl.enabled": "false"
}
}

Stack Trace of error:

17:57:19.515 [2779bbff-d7a9-058c-d133-b41795a0ee58:foreman] ERROR hive.log - Got exception: org.apache.thrift.transport.TTransportException java.net.SocketException: Broken pipe (Write failed)
org.apache.thrift.transport.TTransportException: java.net.SocketException: Broken pipe (Write failed)
        at org.apache.thrift.transport.TIOStreamTransport.flush(TIOStreamTransport.java:161) ~[drill-hive-exec-shaded-1.9.0.jar:1.9.0]
        at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:65) ~[drill-hive-exec-shaded-1.9.0.jar:1.9.0]
        at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.send_get_all_databases(ThriftHiveMetastore.java:733) ~[hive-metastore-1.2.1.jar:1.2.1]
        at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.get_all_databases(ThriftHiveMetastore.java:726) ~[hive-metastore-1.2.1.jar:1.2.1]
        at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.getAllDatabases(HiveMetaStoreClient.java:1031) ~[hive-metastore-1.2.1.jar:1.2.1]
        at org.apache.drill.exec.store.hive.DrillHiveMetaStoreClient.getDatabasesHelper(DrillHiveMetaStoreClient.java:205) [drill-storage-hive-core-1.9.0.jar:1.9.0]

core-site.xml:

<configuration>
<property>
        <name>fs.azure.account.keyprovider.kkhdistore.blob.core.windows.net</name>
      <value>org.apache.hadoop.fs.azure.ShellDecryptionKeyProvider</value>
</property>
<property>
    <name>fs.azure.shellkeyprovider.script</name>
    <value>/usr/lib/python2.7/dist-   packages/hdinsight_common/decrypt.sh</value>
  </property>
  <property>
    <name>fs.azure.account.key.kkhdistore.blob.core.windows.net</name>
    <value>{COPY FROM CLUSTER core-site.xml}</value>
  </property>
  <property>
    <name>fs.AbstractFileSystem.wasb.impl</name>
    <value>org.apache.hadoop.fs.azure.Wasb</value>
  </property>
 </configuration>

Azure handling 404 before htaccess

I would like to allow access of HTML pages without the extension, i.e. www.domain.com/page in addition to www.domain.com/page.html

I was able to modify the existing .htaccess file and it works on my localhost XAMPP environment:

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.html [NC,L]

    RewriteCond %{HTTP_HOST} !^WWW.(.*) [NC]
    RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

When put out onto our Azure hosted environment, it is not handling the extension-less rewrite rule, but it is handling the www rewrite rule.

When I try accessing the page in question without the .html extension I am getting a 404 response with the message:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

It appears that Azure is handling and processing the 404 before my .htaccess is handling the rewrite.

Is there a configuration setting somewhere in Azure that I need to change in order to get this to work?

How to enforce Azure AD login through externally hosted site?

Been googling this for hours, and can't find a clear tutorial or anything..

I have an Azure account with active directories already enabled. I also have an InMotion hosting account that hosts numerous domains (each having their own respective cpanels).

How would I go about integrating Azure AD authentication on a domain that's being hosted by InMotion that only affects that domain and none of the others on that hosting account?

So in theory, you would visit the domain, get hit with the Windows login Auth. page, and if login is successful, you are directed to the home page and can view the content.

Is this do-able through the .htaccess file? Or would I have to alter the actual Apache files? If so, how do I only make it applicable to only one domain?